[Python-ideas] Create Python 2.8 as a transition step to Python 3.x

Andrew Barnert abarnert at yahoo.com
Tue Jan 21 09:27:45 CET 2014


On Jan 21, 2014, at 0:20, "Philipp A." <flying-sheep at web.de> wrote:

> you’ll have to do quite a bit:
> 
> # -*- coding: utf-8 -*-
> from __future__ import print_function, division, unicode_literals, absolute_import
> 
> from io import open
> 
> range = xrange
> str = unicode
> basestring = (str, bytes)  #for isinstance()
Plus importing imap and ifilter as map and filter, and renaming modules in some way rather than just builtins, and of course you have to wrap half of that in a try and/or if sys.version_info check, or it won't run in 3.x, which defeats the purpose...

Which is why I create a project-specific module so I can just "from sixify import *" (along with the future statement, of course) at the top of every module, and it's all taken care of in two lines.



> 
> 2014/1/21 Eric V. Smith <eric at trueblade.com>
>> On 1/19/2014 10:40 PM, Bruce Leban wrote:
>> > I think the odds of Python getting
>> >
>> >         from __future__ import pony
>> >
>> > are slightly higher than there being a Python 2.8. I assume by "pony"
>> > you really mean what I'd like to have:
>> >
>> >         from __future__ import everything
>> >
>> > since my goal is to write Python 3 compatible code even though I'm
>> > temporarily stuck with Python 2 due to stack issues. The __future__
>> > imports makes it easier to write forward compatible code. As it is, I
>> > have to list the individual imports in every file and I also add:
>> >
>> >         range = xrange
>> 
>> It's unfortunate we didn't add this (and all other changed builtins) to
>> future_builtins in 2.7.
>> 
>> Eric.
>> 
>> 
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
> 
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140121/8a2eb37a/attachment.html>


More information about the Python-ideas mailing list