Using Python 2

Chris Angelico rosuav at gmail.com
Fri Sep 8 10:41:39 EDT 2017


On Sat, Sep 9, 2017 at 12:23 AM, Leam Hall <leamhall at gmail.com> wrote:
> Various responses in no particular order:
>
> On 09/08/2017 09:57 AM, Ned Batchelder wrote:
>>
>> I've heard a lot of FUD about the Python 3 transition, but this one is
>> new to me.  What is it that CompSci folks want that developers don't
>> want, that ruined Python 3?
>
> It's not FUD if it's true. Calling it FUD without checking is, um, FUD. The
> phrase was "many of the changes in Python 3 are theoretically based,
> cleaning up of how Python does things to make them fit with what Computer
> Science teaches."

Please give examples. Otherwise it is FUD.

> On 09/08/2017 08:51 AM, Chris Angelico wrote:
>> Let's see. You can port your code from Python 2.7 to Python 3.6 by
>> running a script and then checking the results for bytes/text
>> problems.
>
> I ran 2to3 on some code that worked under 2.6.6. and 3.6.2. 2to3 broke it
> for both versions and it was a fairly trivial script.

Show the code that it broke? I've never seen this, unless it's
something like "now you need to install third-party package X in
Python 3". The 2to3 transformations are fine for everything in the
stdlib.

> On 09/08/2017 08:42 AM, Marko Rauhamaa wrote:
>> That's somewhat irrelevant. Point is, Python 2 will quickly become a
>> pariah in many corporations during or after 2018, and we are going to
>> see emergency measures similar to the Y2K craze twenty years ago.
>>
>> The risk to Python will be whether the occasion is exploited by
>> fanboys of competing programming languages. The migration from Python2 >
>> might be to something else than Python 3 in some circles.
>
> To me this is where the Python community comes in. Moving 3,000 servers from
> RHEL 6 to something that uses Python 3 isn't a trivial task when most of
> those servers are not homogenous HPC nodes.

Of course, but moving ONE server from RHEL 6 to RHEL 7 must surely be
a supported operation. And then moving one more, and one more after
that. The Red Hat folks aren't going to tell you to stay on RHEL 6 for
the rest of time.

> If Python 2 has bugs that aren't going to be fixed, then let's ask the
> question. If Python 3 was a total re-write that is not backwards compatible
> then it likely has some of the same bugs (due to same coders) plus new ones.
> If Python 3 is not a total re-write then why break compatibility?

False dichotomy. It's not a total rewrite, but it fixes certain
long-standing issues. Compatibility had to be broken in order to
change certain behaviours.

> To say Python 2 is old is true. What does it matter though? Unless Python 3
> provides a business value for spending lots of time and money to change then
> "old" doesn't matter.

Of course. And the biggest business value, in a lot of cases, is that
suddenly now your application works for ALL the world's people. A lot
of Python 2 programs, like the equivalents in many other languages,
work fine until someone uses "funny characters". And then their
authors either forbid them, or fiddle around with lots of encoding and
decoding, basically playing whack-a-mole until the problems disappear.
With Python 3, it's completely straight-forward: you know what is
bytes and what is text, and you convert at the boundaries. That's just
one of the advantages of Python 3. A few others, in no particular
order:

* Much better support for asynchronous I/O, allowing higher
per-process throughput for network servers
* Faster Decimal handling
* A much faster way to traverse directory trees
* Several new standard-library modules that do things that formerly
required third-party support

> You're right that people may migrate to something besides Python. For me
> that question is real and some of the fuel is how the community can't
> understand that I work on servers that only have an old version of python.
> So far one person has answered the original design question. Everyone else
> has tried to convince me of something that is financially and professionally
> impossible and completely useless.
>
> If you want to encourage people to move from Python 2 to 3 then continue to
> help answer questions when they are Python 2 based. Over time an individuals
> preference will be to move to Python 3 since 90% of the skill is already
> there. From a purely "is python a good language for many use cases"
> perspective the answer is yes. Welcome people and let their task needs and
> passions drive the change.

If we pretend that Python 3 doesn't exist, how will that encourage
people to move from Py2 to Py3? Be honest now.

Also, be completely honest here: how much work would it take for you
to move your "millions of servers" from Python 2 to, say, PHP? or
Ruby? or C? or JavaScript? Is any of those (or any write-in answer you
wish) actually easier than porting to Python 3?

We've heard the old story of "the Python 3 migration will drive people
away from Python" many, MANY times before. I don't know of any success
stories where someone brags about how easy it was to port their entire
codebase to a different language, and I've read quite a few stories
about people being surprised how easily they could switch to Python 3.

More facts, less FUD, please.

ChrisA



More information about the Python-list mailing list