Live data from Hacker News

Python 2 removed from Debian

bugs.debian.org

151–160 of 513 posts

Re: Python 2 removed from Debian

#151
post #138

Earlier quoted context omitted.

Well, trying to sell a project to the higher-ups is a lot easier when you can say > Hey our interpreter for our backend code will be eventually deprecated. It is currently version 2 and we need to move to version 3" Then the execs say "we are on 2?? and there is a 3??! what are we waiting for?!" A whole lot easier than trying to say: > Hey, there is a new interpreter out there called COBRA. We need to rewrite our who…

Meanwhile, in the real world, the feature backlog means that 2 to 3 never happened for a lot of us.

It was a pretty easy sell for us because Django ended Python 2 support in 1.11 So in reality the conversation actually went more like "hey you know the web framework we use for all of our services. yeah, that will be stuck at the same version for forever with no security releases and unable to use any new integrations unless you devote 2 engineers for 3 months and take the medicine now instead of digger a deeper hole"

But it was a lot easier for the CEO to digest `2 -> 3` as a clear path to the future as opposed to switching to a new language.

Re: Python 2 removed from Debian

#152
post #4

And not a decade too soon. The Python 2 -> Python 3 migration will be studied for a long time as an example how not to release a new version of your language or library, right next to that Angular thingy. The number of headaches I've had to deal with because of this over the years have just about soured me on the whole Python offering, and I used to be a pretty big fan. Great that Debian finally pulls the plug on it,…

Forgive my ignorance, but what should have been done instead of the way the Python 2 to 3 migration happened? I know that Python 2 has stuck around for far longer than anyone wanted and that people were (are?) hesitant to migrate from 2 to 3, but I'm not sure what decisions contributed to that.

They should have made the Python 3 interpreter able to embed the Python 2 interpreter. It would’ve then been possible to mark projects as 3 while they continue to import 2 libraries.

Re: Python 2 removed from Debian

#153
post #129

Earlier quoted context omitted.

Very strange, about the whitespace. I write C++ most of the time and I love significant whitespace. I like the combination of power and (...these days, relative...) simplicity of the language for all kinds of helper tools. Probably wouldn't want to use it to write something that is large and / or needs to run fast.

The best thing about significant whitespace is the reduction in pernickety code review comments about it compared to other languages. If you also agree to "just run black" to format code then that kind of bullshit drops to almost 0 in a team.

But if you agree on a certain formatting tool anyway, then you don't need significant whitespace to get that. That's one of the things I like most about Go. It shipped with gofmt from day one, so literally no one ever argues about coding style.

Re: Python 2 removed from Debian

#154
post #118

Meanwhile we are still living our Python 2 like moments in .NET and JVM ecosystems, with the huge amount of projects stuck in .NET Framework and Java 8, with no end in sight of them ever moving forward.

It's not as big of a deal, though. Code written for java8 is still source backwards compatible on newer platforms. And in .net/jvm you're not depending on some interpreter on the OS level and don't have code bundled with the OS, as has been the big issue with lots of small python scripts included in various distros.

On .NET Framework you surely depend on OS integration, that is one of the major design changes in .NET Core.

Starting with Java 9, finally the long deprecated APIs started to be removed.

In any case, the issue is that we are forced to write C# 7 and Java 8 code.

Some well known examples, Sitecore, SharePoint WebParts, SQL Server SP extensions, Dynamics, Office AddIns, VS plugins, Solr extensions (many places keep using Solr on Java 8 even if more recent versions exist), Android (unless one goes Kotlin or targets version 12), Forms and WPF 3rd party components (the versions on .NET Core are incompatible due to new designer)...

Re: Python 2 removed from Debian

#155

Earlier quoted context omitted.

Well, trying to sell a project to the higher-ups is a lot easier when you can say > Hey our interpreter for our backend code will be eventually deprecated. It is currently version 2 and we need to move to version 3" Then the execs say "we are on 2?? and there is a 3??! what are we waiting for?!" A whole lot easier than trying to say: > Hey, there is a new interpreter out there called COBRA. We need to rewrite our who…

I do like the optimistic worldview of execs being like "version 2?! version 2 sucks!! I want version 3, of that thing you just said"

Ha ha, well that was almost the CEOs verbatim reaction at a multi-billion dollar company. It helps if you are a financial services company and also add on "and if we dont do it, our web frameworks will reach EOL and have no more security updates"

Re: Python 2 removed from Debian

#156

Earlier quoted context omitted.

Python had that long before js, with __future__ imports. But editions & friends are for syntax. Python 3 changed semantics all around. Editions are not an option when you’re changing the langage’s entire text model, especially without static typing.

Could they have at least minimised the blast radius? For example, make all of the text/Unicode changes for Python 3 and thats it . Python 3.1 could then have introduced some of the other minor changes, perhaps behind a future import. I had a hand in moving from 2.7 to 3.6 for a 1M LOC repo and it was not pleasant. So many backward compatible changes that that all had to be accounted for rather than being able to focu…

> Could they have at least minimised the blast radius? For example, make all of the text/Unicode changes for Python 3 and thats it.

Except "that's it" does a ton of work here, as the entire stdlib had to be audited and updated to correctly work with the new text model, plus other semantics change (e.g. the removal of total ordering).

That those were so large and wide-ranging in the first place is why the core team decided that fixing a bunch of other issues could go in as well e.g. reorganise the stdlib, move keywords to functions, remove deprecated stuff, etc...

Those ancillary changes were mostly pretty easy to implement.

> I had a hand in moving from 2.7 to 3.6 for a 1M LOC repo and it was not pleasant. So many backward compatible changes that that all had to be accounted for rather than being able to focus on the major breaking change of a particular version.

It wouldn't have been more pleasant if the breaking changes had been spread over multiple versions, you'd still have eaten all of those, and the early adopter would have gotten even more pain as they'd have needed to implement breaking changes on every update.

> We couldn’t have done it without six.

We did just fine without six migrating a hundreds-kloc-scale repo from 2.7 to 3.5, we basically copied what Werkzeug did, with our own "minisix" module for just the bits we needed (some lifted from werkzeug's and others bespoke e.g. we needed a compatibility layer for CSV).

We could not, however, have done without the 3.0 - 3.3 improvements, the existence of 2.7, or the community experience.

And tests. Having a well-tested codebase was absolutely essential to a comfy migration, the less a corner of the codebase was tested, the more migration bug kept popping up afterwards.

> It seems that a bunch of changes were made all at once because it was already going to be incompatible so let’s take the opportunity to clean up as much as possible. I think that was the big mistake.

No, doing all those breaking changes version after version would have been a lot worse. IME the vast, vast majority of the pain (short and long term) came from the semantics changes, not the syntactic ones. Those were relatively easy: do the syntactic change, enable the corresponding lint (so colleagues don't reintroduce the old construct out of habit), commit. A few of the API changes were frustrating (like base64 which was clearly mis-converted by the core team but what do you do).

- the text model stuff took by far the longest and had by far the longest tail (as in things we missed during the migration), this is in part because not all of the changes or Python 3 APIs are ideal, but mostly it's just a lot of runtime things in a lot of paths if your software leverages strings a lot

- total ordering removal broke a surprising amount of things, and also had a pretty long tail of bugs, mostly in that `None` would get mixed in with other values and get fed to comparison operators, sorting, or min/max

- `round` was a surprise contender for pain in the ass, not just because it changed the rounding method (to banker's rounding, from I don't remember what) but also because P2's round() always returned floats while P3 returns integers if precision is missing / None

- changes to dict iteration also broke a few things, there were multiple pieces of code with implicit reliance on iteration order, although for the most part they were issues in numerical stability of floats, which broke tests using strict equality on floats

- division changes also broke a few things as it wasn't always easy to recognise whether operands were always floats or could be int, also `//` being floor division rather than integer division led to a few behavioural changes

We also did a few things like banning the builtins which had changed behaviour (open, map, filter, ...) for the duration of the migration, the issues they caused were subtle enough as to not be worth it. They were re-allowed once we dropped P2.

Re: Python 2 removed from Debian

#157
post #122

As mentioned by several people already, the migration process from 2 to 3 was really painful. It will be easier for the Python core maintainers, but introducing a breaking change with the intent that that version 2 will be deprecated has probably caused more distress overall, especially maintainers of other open source projects which rely on a specific python version. Let's never have the same kind of breaking change…

I see people saying that the migration was painful, but my own experience with two separate Python 2->3 migrations were so smooth they might as well have been a minor version bumps. I don't know where this discrepancy comes from.

Some time ago we migrated a few hundred thousands lines of Py2 spread over dozens of services. Easiest case possible: every service can be converted and tested separately.

Took a calendar year of ca-a-a-arefully migrating these one by one, all while delivering stuff and making sure nothing falls apart along the way.

Not pleasant. Can't recommend.

Re: Python 2 removed from Debian

#158
post #138

Earlier quoted context omitted.

Meanwhile, in the real world, the feature backlog means that 2 to 3 never happened for a lot of us.

It was a pretty easy sell for us because Django ended Python 2 support in 1.11 So in reality the conversation actually went more like "hey you know the web framework we use for all of our services. yeah, that will be stuck at the same version for forever with no security releases and unable to use any new integrations unless you devote 2 engineers for 3 months and take the medicine now instead of digger a deeper hole…

Much harder.for us as our code base predates Django so we (years before I was hired) have our own framework, our own orm, … so we’d basically have to port everything all at once, with no clue if we other half is correct until you’ve ported both.

Re: Python 2 removed from Debian

#159
post #137

Earlier quoted context omitted.

The people it lost are going to things other than python3.

Yeah, I mean personally the only thing that would keep me in the community is wxPython, which AFAIK still only supports Py2.

The last wxPython release that even supported py27 was from close to three years ago, and you would have known if you spent half a minute looking into it before making an absurd claim.

Re: Python 2 removed from Debian

#160

It craps me off that I still need to look up which direction to encode/decode strings and other things like bytes and ascii even after programming Python 3 for more than 10 years. It's a huge usability fail on the part of Python that it's not obvious and easily memorable how to do this.

You encode strings to bytes, you decode bytes to strings. A string is an abstract representation of text, which can be encoded into whatever supported format you'd like; bytes are a concrete representation of binary data, such as text encoded in UTF8, which, if it represents text, can be decoded to obtain a string.

If you think about it, that's the only way that makes sense; if you wanted to go from, say, UTF8 to UTF16, you'd need to have an intermediate step that was abstract and formatless. Similarly, when you're operating on text, you don't want it to have a particular format; the format should only exist at the edges, where you take text in and output it. The format is a way to communicate with other programs, not components within your program.

My advice would be, if that doesn't stick in your head (totally legitimate), write down a code example and stick it in a personal wiki or something. I find it really helps me to understand something once and more or less copy paste it forever.

Post reply on HN