[Python-Dev] Proposal: from __future__import unicode_string_literals
Terry Reedy
tjreedy at udel.edu
Tue Mar 25 00:39:39 CET 2008
""Martin v. Löwis"" <martin at v.loewis.de> wrote in message
news:47E78226.1070607 at v.loewis.de...
I think we all can agree that we would like Plone to migrate to 3.x without
too much pain and that their collective situation may be more difficult for
migration than some others.
| http://wiki.python.org/moin/PortingDjangoTo3k
|
| Just to repeat myself: With that patch to Django, you can
| a) support all versions of Python simultaneously, from 2.x to 3.0
I find this surprising for two reasons.
1. I had the impression from discussions over the past year that fully
automatic use of 2to3 would presume use of 2.6 and its backported 3.0
features and __future__ imports. If it really works with ealier 2.x code,
great, but please pardon any initial surprise or scepticism.
2. You report has caveats such as
* there are certainly large parts of the code base that I haven't touched,
so more issues are likely to show up
*This port attempts to maintain compatibility with older Python versions
from a single code base; the goal is to support all versions that Django
supports, plus 3.0. The current patch fails to do so in certain details,
due to bugs in the 2to3 tool.
*This approach mostly works, and has the following flaws:
some of the fixers work incorrectly (bugs 2453, 2446, 2468)
*I have worked with sqlite3 only; all the other databases have not been
tested.
So your unqualified assertion seems more like an anticipated future
(certain to you but maybe not to others) than present reality.
3. Also, you said you worked around some 2to3 failings with conditional
blocks like, I presume, the following.
if sys.version < (3,0,0): <old 2.x code>
else: <revised 3.0 code>
Do I assume correctly that you, rather than 2to3 had to do such?
Will 2to3 remove the wrapper to leave just the 3.0 code?
Or would someone have to go thru by hand to get clean 3.0 code?
I understand that this is a standard method for multiple release code, but
it seems a bit like cheating since the point of 2to3 is to not to have to
do this. Or is converting 'types.ClassType' to 'types' a future fixer
item?
Terry
More information about the Python-Dev
mailing list