[Python-Dev] Problems with unicode_literals (original) (raw)
Guido van Rossum guido at python.org
Sat Jan 17 04:26:00 CET 2009
- Previous message: [Python-Dev] Problems with unicode_literals
- Next message: [Python-Dev] Problems with unicode_literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
On Fri, Jan 16, 2009 at 6:42 PM, Barry Warsaw <barry at python.org> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I've been playing with 'from future import unicodeliterals' just to see how unicode unclean some of my code was. Almost everything was fairly easy to fix but I found two interesting situations. One seems fairly shallow and might arguably be fixable in Python 2.6 (but probably not :). The other clearly can't be addressed in Python 2.6, but the question is whether it should be changed for Python 2.7. Here's some sample code: - -----snip snip----- from future import unicodeliterals def foo(a=None, b=None): print a, b # This is a TypeError foo(**{'a': 1, 'b': 2}) foo(**dict(a=1, b=2)) from optparse import OptionParser parser = OptionParser() # This also raises a TypeError parser.addoption('-f', '--foo') - -----snip snip----- The addoption() failure is a one-line fix. - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iQCVAwUBSXFFmnEjvBPtnXfVAQKx0QP/Un7RG++ugtgywBHXd+pWTD2V7QC1JDqP rpIkwqocicMZiNBbg0NS5/TSGHa0CyaQphDmBBeNFr7jFb4rxdUESyLmBNNIz7dV /PEBZxJp5ZjTGCIylEJoXHMSN102wqe/n6QAAGqV5ce7e3Fhr8b7kU2m7cMT6yDQ /1b4riH/H0Y= =dp0u -----END PGP SIGNATURE-----
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Problems with unicode_literals
- Next message: [Python-Dev] Problems with unicode_literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]