Nick Craig-Wood wrote:

> If come python 3, there is a 99% accurate program which can turn your
> python 2.x into python 3 code, then that would ease the transition
> greatly.

Guido wrote:

> That might not be so easy given the desire to change most
> list-returning functions and methods into iterator-returning ones.

I assume part of the cleanup will include adding a choke point
for import hooks.  That way people could do the conversion
on modules that they aren't sure about.  There would be a 
performance penalty, but things would still work, and could be
sped up as it was justified.

> This means that *most* places where you use keys() your code will
> still run, but *some* places you'll have to write list(d.keys()). How
> is the translator going to know? 

So do it everywhere, in the auto-import.  

> Worse, there's a common idiom:
>    L = D.keys()
>    L.sort()

> that should be replaced by

>    L = sorted(D)

    L = list(D.keys())
    L = sorted(L)

Not as efficient.  Not as pretty.  With work, even a 
mechanical importer could do better.  But the old 
code would still run correctly.

-jJ
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to