[Python-Dev] PEP 414 - Unicode Literals for Python 3

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Feb 27 15:40:53 CET 2012


Barry Warsaw <barry <at> python.org> writes:

> As for the "working" part, I forget the details, but let's say you have a test
> suite in your package.  If you run `python setup.py test` in a Python 2 world,
> then `python3 setup.py test` may fail to build properly.  IIRC this was due to
> some confusion that 2to3 had.
> 

There are other things, too, which make 2to3 a good advisory tool rather than a
fully automated solution. 2to3 does a pretty good job of solving a difficult
problem, but there are some things it just won't be able to do. For example, it
assumes that certain method names belong to dictionaries and wraps their result
with a list() because 3.x produces iterators where 2.x produces lists. This has
caused problems in practice, e.g. with Django where IIRC calls to the values()
method of querysets were wrapped with list(), when it was wrong to do so.

Regards,

Vinay Sajip



More information about the Python-Dev mailing list