I strongly dislike Python 3

Thomas Jollans thomas at jollans.com
Sat Jun 26 12:33:02 EDT 2010


On 06/26/2010 05:59 PM, Stefan Reich wrote:
> Hi there.
> 
> Let me preface this by saying that I am a fan of Python. I use it
> regularly and I like it a lot.
> 
> That is, I am using and liking Python 2.6.
> 
> I don't like Python 3.
> 
> I won't comment on the advanced stuff that is changed in Python 3, as I
> haven't look into that.
> 
> My complaint is about changing the syntax of "print".
> 
> This has probably been talked about on your lists, but I wasn't part of
> that discussion. And I think that everyone has a right to bring up a
> subject at any time if it is still important. And I believe it is
> because Python 3 is out there and it poses a real problem.
> 
> The main problem is that Python 3 is incompatible with almost all
> scripts written for Python 2 (if they use print). And it gets worse:
> Python 3 scripts are incompatible with Python 2! (If they use print
> variants, like writing to a file.)
> 
> Thus the world of Python scripts is split in two incompatible factions.
> All for simplifying the syntax of one statement. That, to me, is pure
> insanity.
> 
> Here's the advantages:
> 
> -Some arcane stuff like redefining "print" in a module (which 99% of
> users will never do) allegedly gets easier.

s/easier/possible/

> -Any more?

Ever had to write this:

def print_wrapper(s):
    print s

in Python 2.x? Well, probably not, but I have.

There is no reason for print not being a function. Also, do you use
print *that* much? Really?

> 
> And here's the disadvantages:
> 
> -The Python 3 syntax actually requires more keystrokes.
Typically ONE extra character: the closing bracket. The opening bracket
can replace the whitespace previously required.

> -Python world split in half. There is now a Python 2 world and a Python
> 3 world, both incompatible with each other.
Sort-of true:
with a few __future__ statements and a little care, scripts can be
portable across 2.6/2.7--3.x. Tools like 2to3 are meant to make the
transition of an old package as painless as possible, and it's not like
there are no packages that support both versions, from one codebase!

I'm looking forward to 3to2 though - allowing me to support Python 2
from Python 3 code. Sounds nice, doesn't it?

> -Libraries written for Python 2 cannot be mixed with libraries written
> for Python 3.

No, but libraries can and do (partly) / will (mostly) support both at
the same time.

> -Developers have to choose between Python 2 and Python 3 and are bound
> to their choice afterwards.

Not quite true with 3to2 and 2to3

> 
> So there are basically no advantages and extremely significant
> disadvantages. The single advantage there is could certainly be achieved
> without breaking all scripts out there.

the print() function is really a minor change. It could be done because
compatibility was broken *anyway*. There are much more important
changes, with much more far-reaching and beneficial consequences for
which I think some pain due to incompatibility is justified:

 * old-style classes are gone. Good riddance!
 * str is now unicode => unicode is no longer a pain in the a****
 * range, map, filter, zip no longer return lists. There are Python 2
   equivalents to the new functions, but this is just nicer.

And this is just what springs to mind, there are quite a few other changes.

Anyway, this is the type of pleasant change we've got Python 3 for.
print-as-a-function is just a minor detail correcting an old mistake,
just because the core devs could. And it's not that bad:

 print ("string")

without output specification, etc, will work with either version.

> 
> Consider Java as a better example: JDK 1.6 still runs and compiles
> everything written for JDK 1.0. That is proper management. Python 3 is,
> I'm sorry to say, an example of unfathomably bad management.

Python 3 was deliberately incompatible. Before 3.0, every new Python
release was backwards compatible. This one single release intentionally
dares to break things in order to fix old mistakes that couldn't have
been fixed otherwise.

> 
> To reiterate, I am strongly in disfavor of Python 3 and will stick to
> Python 2, for as least as long as Python 3 breaks my scripts.

I trust you've also read Stephen Hansen's post, which arrived while I
was writing this.

-- Thomas



More information about the Python-list mailing list