-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jan 16, 2009, at 10:26 PM, Guido van Rossum wrote:

Is the issue that in foo(**{'a': 1, 'b': 1}) the 'a' and 'b' are
unicode and not acceptable as keyword arguments? I agree that should
be fixed, though I'm not sure it'll be easy.

I'm not sure you're saying that the optparse case shouldn't be fixed
in 2.6. or the foo(**{...}) shouldn't be fixed in 2.6, though I think
the latter.

Yep, sorry, it's been a long week. ;)

The optparse one could easily be fixed for 2.6, if we agree it should be fixed. This untested patch should do it I think:

Index: Lib/optparse.py
===================================================================
- --- Lib/optparse.py   (revision 68465)
+++ Lib/optparse.py     (working copy)
@@ -994,7 +994,7 @@
         """add_option(Option)
            add_option(opt_str, ..., kwarg=val, ...)
         """
- -        if type(args[0]) is types.StringType:
+        if type(args[0]) in types.StringTypes:
             option = self.option_class(*args, **kwargs)
         elif len(args) == 1 and not kwargs:
             option = args[0]

Should this be fixed, or wait for 2.7?

The fact that 'a' and 'b' are unicodes and not accepted as keyword arguments is probably the tougher problem. I haven't yet looked at what it might take to fix. Is it worth fixing in 2.6 or is this a wait-for-2.7 thing?

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSXFUWHEjvBPtnXfVAQK0cgQAt5CqfAYmDCCaN7XkplrYg1mr2B6SBj5Q
oPGxuYaQAu5k4iEcicl27JFElbzzAqMtJ/bpRPVajQlagZt8s7o+dbn/dhHvIBpQ
u2nPUAtBcfoqvfMvoaCmA9xixI/N4z1dAJjkifwG9n2Dh/PhDzc6KuFFXthh6Euy
KnguC64McvE=
=U2B+
-----END PGP SIGNATURE-----
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to