News for hackers. Stuff that matters.
Re:Pandas dropping Python 2 support by gammateam on Thursday January 03, 2019 @12:11PM (#18816764)
Amazing, everyone dropping python2 should have been 2010s headline but hey whats another decade
Re:Pandas dropping Python 2 support by rogerbinns on Thursday January 03, 2019 @01:01PM (#18817315)
You didn't hear much from the people using Python 2 to get things done. Here is what happened in that world:

* there were no syntax changes, no new keywords, no deprecations, no coloured functions (http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...), no major changes in the standard library etc

* some sore points (eg subprocess & threads) had backported modules with fixes

* python 2.7 continued to be supported by major third party libraries, and they tended to avoid wholesale changes

* binary compatibility and testing are easy (I have a python binary module compiled on 32 bit ARM in 2014 that still loads without recompilation today)

ie python 2 is more than sufficient to solve real world problems, and in the last decade has been stable, debugged, and predictable. You generally don't hear from folks doing this!

Much like C++, Python 3 still has the problem of which subset of language features to use since they affect minimum Python 3.x version, interaction with libraries etc.

The Python 2 -> 3 transition is going to be a case study for a long time. All the intentions and planning seemed right, yet here we are a decade later. There are difficult trade offs between new productivity, stability and predictability, and giving things time to mature, with space to make mistakes. As an example Rust seems to be applying the lessons learned.

Re:Pandas dropping Python 2 support by t0mbstone on Thursday January 03, 2019 @03:37PM (#18819052)
The biggest problem with the python 3 rollout was the decisions that were made to arbitrarily deprecate functionality that could have easily been supported.

Just because you add a new way to do something doesn't mean you have to get rid of the old way, too.

Another big mistake that they made was not providing any tooling to automatically convert python2 to python3 code.

Re:Pandas dropping Python 2 support by dragonwriter on Thursday January 03, 2019 @03:40PM (#18819072)
> Just because you add a new way to do something doesn't mean you have to get rid of the old way, too.

It kind of does if a central part of the stated philosophy of your language is “There should be one—and preferably only one—obvious way to do it.” [0]

And, sure, you may say backwards compatibility creates a special circumstance that is an exception, but “Special cases aren’t special enough to break the rules.” [0]

[0] PEP 20, The Zen of Python, https://www.python.org/dev/peps/pep-0020/

Re:Pandas dropping Python 2 support by eesmith on Thursday January 03, 2019 @04:38PM (#18819542)
Just how many ways does Python have to format a string? I can think of at least four: fmt % args, fmt.format(args), string.Template, and f"fmt".

Just how many ways are there to make a string constant? single and double quotes, 'single quoted' and """triple quoted""", r"aw" and u"nicode". Probably more.

That does feel like sometimes it's okay to support the old way too.

Re:Pandas dropping Python 2 support by joshuamorton on Thursday January 03, 2019 @05:19PM (#18819915)
>Just how many ways are there to make a string constant? single and double quotes, 'single quoted' and """triple quoted""", r"aw" and u"nicode". Probably more.

Those all have different semantics. They aren't the same thing. In python 3, `''` is a unicode string. `b''` is a byte-string, `''''''` is a multiline unicode string, and `r''` is a string where backslashes are handled specially (which is useful for storing regexes and escape sequences in a human readable way).

Each of those is the obvious way to do the thing. Note that the rule isn't "one way to do things" but "one obvious way". Its possible to generate a multiline string by joining a bunch of lines with `\n`, but its more obvious to use the enter key.

>I can think of at least four: fmt % args, fmt.format(args), string.Template, and f"fmt".

Indeed, and most would argue that % formatting should be deprecated (and would have been, if the stdlib logging module didn't rely deeply on it). Format strings and f strings, are approximately equivalent, but strings.Template objects serve a different purpose.

Re:Pandas dropping Python 2 support by eesmith on Friday January 04, 2019 @01:07AM (#18822292)
What is the obvious way to write a string constant which does not contain a newline, single quote, or double quote? Should I write it: "this way" or 'this way'? PEP 8 explicitly says there is no preference.

Sure, they have different semantics. But the Zen of Python suggestion isn't usually interpreted to accept, say, a 99% overlap in functionality.

Re:Pandas dropping Python 2 support by joshuamorton on Friday January 04, 2019 @01:17AM (#18822326)
You didn't mention `''` vs `""`. Those have the exact same semantics. And indeed there is no preference. The zen isn't a 100% unbreakable set of rules, its guidelines though, so I'm not sure what you're trying to get out of catching Python violating a document that contains the lines

> Special cases aren't special enough to break the rules. > Although practicality beats purity.

The entire zen is self-contradictory, and people are well aware that python breaks the "rules" in some places. That doesn't make the guidelines bad, nor does it make the fact that they guide most of the language and its design less true.

Having 2 ways of defining string constants is useful. And given that practicality beats purity and all, its acceptable to violate the Zen when its sufficiently useful.

Re:Pandas dropping Python 2 support by eesmith on Friday January 04, 2019 @03:34AM (#18822676)
My point is that dragonwriter's interpretation of the Zen of Python is not a strong argument against backwards compatibility support. Your comments support my argument, but you seem to have misread them as an indictment of how Python does things.

Here's the thread:

t0mbstone: shouldn't "arbitrarily deprecate functionality that could have easily been supported"

dragonwriter: They should be because of the Zen of Python.

eesmith (me): but Python does support old functionality, so don't place much weight in how to interpret the Zen of Python as it applies to (C)Python development.

I did not say exactly that because I thought the inference was easy to make given the g'parent threads.

Re:Pandas dropping Python 2 support by joshuamorton on Friday January 04, 2019 @04:22AM (#18822825)
Ah, but here's the disagreement:

> but Python does support old functionality

is completely compatible with "should deprecate functionality that could have easily been supported". There should be only one way to do it is correct. Under the zen, you should bias towards deprecation. That doesn't mean deprecate every old functionality always. Indeed if there are compelling reasons not to deprecate something (the maintenance cost truly is zero, it is infeasible, the new functionality only covers a subset of uses, etc.) you shouldn't!

The python mailing list and peps have a good bit of discussion about most backwards incompatible changes from py2 -> 3 (and more recent ones, like adding new keywords).

Re:Pandas dropping Python 2 support by eesmith on Friday January 04, 2019 @04:59AM (#18822935)
Yes, and I pointed out one of the reasons for not supporting backwards compatibility in https://news.ycombinator.com/item?id=18819491 . There are many others of course.

It's in a parallel thread because it's a response to t0mbstone's statement that Python developers should have done more work to support backwards compatibility.

I am not saying that Python should "deprecate every old functionality always", but that is what dragonwriter seems to be arguing.

dragonwriter made a different argument about why to drop backwards compatibility, based on an interpretation of the Zen of Python. My response on this thread is to say that that interpretation of the Zen of Python is not valid, or at least weak, given that it does not explain Python's own development history.

Something that I am sure that you agree with.

I don't see where your views disagree with mine.

Re:Pandas dropping Python 2 support by eesmith on Thursday January 03, 2019 @04:32PM (#18819491)
"could have easily been supported"

While true in the abstract, who will do that support? Python core developers are stretched enough as it is. Why should they volunteer for that?

"not providing any tooling to automatically convert python2 to python3 code"

They did - https://docs.python.org/2/library/2to3.html ("2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code"). In practice that turned out to not be approach that most people wanted to do, but you can't say they provided no tooling.

Re:Pandas dropping Python 2 support by throwaway12iii on Thursday January 03, 2019 @01:49PM (#18817913)
What is wrong with LTS releases? That's what python 2.7 is.
Re:Pandas dropping Python 2 support by orf on Thursday January 03, 2019 @02:27PM (#18818342)
> * binary compatibility and testing are easy (I have a python binary module compiled on 32 bit ARM in 2014 that still loads without recompilation today)

I'm confused, are you trying to say a module compiled for Python 2.7 still works with Python 2.7?

Re:Pandas dropping Python 2 support by rogerbinns on Friday January 04, 2019 @10:22AM (#18824586)
I am saying exactly that. Note that it still works across compiler upgrades, libc updates, OS upgrades, python itself updates etc.

By contrast if you compile a module against Python 3.4, it won't even work the same day against Python 3.5. ie the ever changing Python 3.x is more busy work than Python 2.7.

Re:Pandas dropping Python 2 support by orf on Friday January 04, 2019 @10:32AM (#18824658)
> I am saying exactly that. Note that it still works across compiler upgrades, libc updates, OS upgrades, python itself updates etc.

Of course it does. Just like every other version? Compile something for Python X and it will continue working for Python X, where X is 2.7, 3.1, 3.4, etc etc.

Overall your point seems to be very confused: Modules compiled for a Python version that has had no updates in 15 years still work, and this is somehow relevant to modules working across Python releases? You're comparing apples to oranges here I feel.

> By contrast if you compile a module against Python 3.4, it won't even work the same day against Python 3.5. ie the ever changing Python 3.x is more busy work than Python 2.7.

Sure, that's a different thing. That's across Python versions. As a counterpoint, Tensorflow built for Python 3.6 before 3.7 even began development runs just fine on 3.7.

Of course the C-API evolves, and you'll have to adapt your C-API modules. As an example 3.6 made some changes[1].

1. https://docs.python.org/3/whatsnew/3.6.html#build-and-c-api-...

Re:Pandas dropping Python 2 support by gammateam on Thursday January 03, 2019 @03:30PM (#18818994)
I get it

This isnt really about rationalizing Python2

Its about different branches of a programming language bearing sequential names

Thats the only real UX problem here

Naming candidates: Python++, Python Vision, Python Classic/Python, Python Core

Re:Pandas dropping Python 2 support by WorldMaker on Thursday January 03, 2019 @06:14PM (#18820312)
How would that do anything but make it worse? If you want a real world example, how about VB6 versus VB7 and its rebrand as VB.NET (though still called VB7 by its team, and the version numbers remain sequential from there). People will fight that language war for the rest of their lives.
Re:Pandas dropping Python 2 support by orf on Thursday January 03, 2019 @12:17PM (#18816840)
I'm not sure the packaging ecosystem, the project messaging/marketing or the interpreter itself was ready for the transition then.

Which is unfortunate. But hey, all good things come to those who wait. And wait. And wait.

Re:Pandas dropping Python 2 support by sephoric on Thursday January 03, 2019 @12:24PM (#18816918)
Sometimes all that's needed is a little pressure and motivation mixed with morale from strong leadership to encourage people to spent a day or so upgrading and testing. Maybe not in this case though. That might not have been enough here, who knows.
Re:Pandas dropping Python 2 support by AnonymousPlanet on Thursday January 03, 2019 @12:48PM (#18817158)
This kind of smug armchair analysis is great as long as all your projects are just a couple of thousand lines. Try updating in "a day or so" when you have millions of lines of Python 2 code. And your code runs at hundreds of customer sites. "Two years or so" is much more realistic. If and only if you have the manpower.
Re:Pandas dropping Python 2 support by ilayn on Thursday January 03, 2019 @01:35PM (#18817731)
I used to think along those lines but I don't buy this argument anymore. Many impossible-looking companies just switched pretty seamlessly Instagram, Dropbox etc being among the big ones. Besides, you never hear about what is difficult about the migration as opposed to why it might be difficult because a lot of lines. I have been hearing this since a few years instead of repeating the same thing they would have ported by now should they even bothered.

Here are all the milestones https://python3statement.org/

Re:Pandas dropping Python 2 support by celias on Thursday January 03, 2019 @02:09PM (#18818141)
There is a discussion about Instagram's approach to migrating to python3 around the 34 minute mark in this talkpython podcast https://talkpython.fm/episodes/show/155/practical-steps-for-... Lisa Guo's presentation starts around the 13 minute mark in the 2017 keynote linked to on that page.

Here's a blog post about Dropbox migrating from python 2 to 3 https://blogs.dropbox.com/tech/2018/09/how-we-rolled-out-one...

Re:Pandas dropping Python 2 support by pseudalopex on Thursday January 03, 2019 @09:28PM (#18821486)
Facebook and Dropbox took years to switch. Instagram took at least 10 months. (I think that was just the big push.) They switched after the Python developers added compatibility features in 2011 and 2012 and libraries had time to catch up.
Re:Pandas dropping Python 2 support by marcosdumay on Thursday January 03, 2019 @01:27PM (#18817630)
Well, I shrug imagining what millions of lines of Python looks like.

I can't think of any open Python project with that size, and I can't imagine an organization maintaining one. And I can easily agree that such project won't migrate from Python 2 to 3 in a year. It won't migrate in a decade either, or in a century.

Re:Pandas dropping Python 2 support by hermitdev on Thursday January 03, 2019 @01:46PM (#18817874)
At a previous employer, I left behind maybe not millions of lines of Python 2 code, but certainly somewhere in the hundreds of thousands range. There was also a fair amount of reliance on 3rd party libs for databases, IBM MQ and tibrv that had native components. We also had our own Python libs that had native components written using Boost Python.

Large Python projects are possible, but if you don't have good discipline and organization, it can quickly become a mess (probably true regardless of the language).

I'm not sure how much effort it'd be to migrate all of that to Python 3, but I'm sure it's not trivial. But, I also don't think it'd be a multi year effort. It also wasn't a big monolithic project, so a migration could be done piecemeal.

Re:Pandas dropping Python 2 support by eesmith on Thursday January 03, 2019 @05:07PM (#18819802)
You made me curious so I looked around. I couldn't easily find an open Python project with 1M+ LOC.

Python 3.7 has 542,292 lines of Python, according to David A. Wheeler's 'SLOCCount' . And another 418,581 lines of C.

NumPy has 159,208 lines of C and 113,842 of Python.

SciPy has 174,580 lines of Python, 83,155 of C, and 79,514 of Fortran.

Pandas has 225,417 lines of Python.

Put them all together and that's 1M lines of Python to run the standard Python data stack.

Re:Pandas dropping Python 2 support by AnonymousPlanet on Thursday January 03, 2019 @06:15PM (#18820324)
I wasn't talking hypothetical, I was talking out of my own experience. Yes, these codebases exist and, yes, maintenance isn't easy, especially because of dynamic typing.
Re:Pandas dropping Python 2 support by jakevn on Friday January 04, 2019 @12:48PM (#18826006)
OpenStack has millions of lines of Python, I believe.