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

Steven D'Aprano steve at pearwood.info
Sun Jan 19 03:34:19 CET 2014


On Sat, Jan 18, 2014 at 07:14:13PM -0600, Neil Schemenauer wrote:
> On 2014-01-17, Andrew Barnert wrote:

> > And if you do it that way, you could even adapt the idea someone
> > proposed a few weeks ago—not popular on this list, but maybe
> > popular with your target audience—of turning each change on and
> > off with a "from __past__ import misfeature" statement, so people
> > could pick and choose the ones they need, and gradually remove
> > past statements as they port from your forked 2.8 to real 3.4.
> 
> You can't make those changes with __future__/__past__ imports.  They
> effect the whole runtime, not single module.

I believe you are wrong. from __future__ imports are designed to effect 
the single module they are in. I see no reason why from __past__ can't 
work the same way.

[steve at ando ~]$ cat a.py
def func():
    return "Hello World"
[steve at ando ~]$ cat b.py
from __future__ import unicode_literals

def func():
    return "Hello World"
[steve at ando ~]$ python2.7 -c "import b, a; print repr(b.func()), repr(a.func())"
u'Hello World' 'Hello World'


-- 
Steven


More information about the Python-ideas mailing list