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

anatoly techtonik techtonik at gmail.com
Sun Jan 19 10:08:27 CET 2014


On Sat, Jan 18, 2014 at 6:22 AM, Neil Schemenauer
<nas-python at arctrix.com> wrote:
> The transition to Python 3 is happening but there is still a massive
> amount of code that needs to be ported.

That's a common illusion. Python 2 is a good binary language, Python 3
is a good text language. Leaving things as-is saves lifetime and
energy. There is a conflicting constraint that you can't get all
three:

1. readable language
2. work with strings as abstract unicode datapoints
3. work with strings as binary data

Python 2 was more explicit for unicode data (and this was tiresome for
text lovers) and Python 3 is explicit about binary (which makes life
harder for those who work with binary data).

> One of the most disruptive
> changes in Python 3 is the strict separation of bytes from unicode
> strings.  Most of the other incompatible changes can be handled by
> 2to3.

2to3 is far from being a perfect tool, not a user level one, for sure, but
I don't maintain list of all things that cause troubles. Probably the major
one is that there is no docs how to write own fixers (and you need that
for 3rd party projects).

The thing I disagree is that incompatible changes can be handled by 2to3.
There are many internal things that make Python 3 awesome, but they
were not ported to Python 2, because people wanted "the next better
thing" and thought about Python 2 as a dead end. Some of us still think
this way, but I hope that recent threads made them more flexible.

Many internal features would be good to be backported into Python 2
series and these are invisible on 2to3 level.

> Here is a far out idea to make transition smoother.  Release version
> 2.8 of Python with nearly all Python 3.x incompatible changes except
> for the bytes/unicode changes.  This could include:
>
> - print as function
>
> - default string literal as unicode

And this will be literally the end of Python 2.8 in the same way as Python 3.
Just attach here the list of consequences. Good exercise for story-writing:
"And now all strings are unicorne".

> - return view objects for dict.keys(), etc
>
> - rename modules in standard library
>
> - rename long to int
>
> - rename .next() to __next__()
>
> - accept only new 'raise' syntax
>
> - remove backticks for repr
>
> - rename unicode to str
>
> - removal of 'apply', 'buffer', 'callable', 'execfile'
>
> - exec as function
>
> - rename os.getcwdu() to os.getcwd()
>
> - remove dict.has_key
>
> - move intern to sys.intern()
>
> - rename xrange to range
>
> - remove xreadlines
>
> New features of Python 3.x could be backported if easy since they
> could be useful to entice developers to move from 2.7 to 2.8.

What if people don't need bloated Python with all there features?
What if Python 4 should not only move stdlib into modules, but features
also?

I look at this list as an RPG called "Personal Python". You generate
you character by selecting traits you like. Some of them are conflicting
like "default binary vs unicode". Once your character is ready, you may
start to play with it. Probably something I'd expect from PyPy project,
but well it requires more engineering and experiment time than it is
possible in open source projects. Here is the idea without
implementation how to pack those features:

http://techtonik.rainforce.org/2013/04/program-config-as-dna-strand.html

> An alternative approach to producing Python 2.8 would be to start
> with the Python 3.x latest branch.  Modify bytesobject and
> unicodeobject to have as close to Python 2 behavior as practical.

I'd start with PyPy. They need more help with Python 3 transition.

> A-journey-of-a-thousand-miles-begins-ly y'rs


More information about the Python-ideas mailing list