109 points · by thunderbong · 2y ago · 193 comments
I get that for people for whom Python is their main language, all these changes make their lives better. But for me it kinda just gets in the way. Personally, I wish Python would continue to be maintained as is, but stop changing so much. Stop breaking my builds.
Python changes because of three reasons: Addressing bugs and insecure patterns; support for new usage patterns in the community; updates for compatibility with newer devices and systems.
The first one is a given. The second and third are basically "the world is evolving, with or without you". Even if you built a VM on your perfect machine, with your perfect python and perfect libraries and froze everything for 10 years, the moment you connected it to the internet you'd be faced with "Ah, my perfect version does not support this new thingamajig being used on the web".
Freezing everything in time is just archiving.
None of this explains why python has the need to drop modules for the standard library.
They claim "nobody is maintaining them"… but they are well funded and can easily afford someone to maintain them.
I think at the core they don't care about backwards compatibility, but instead of doing it all at once like with python2/3 are now doing it little by little, creating a python4 without calling it so.
You still have to find someone who both wants and can maintain them. That's not always a given.
And also, why? If I donate to the PSF, do I really want my money to go into the maintenance of ... checks notes ... MacOS 9 path manipulation functions (https://docs.python.org/it/3.7/library/macpath.html)?
Just because you're well-funded doesn't mean you get to spend money on useless things. And most of the python community would consider this useless. Nobody even made a pypi copy of it.
That's the unfortunate modern trend. The web folks that move fast and break things love living on the bleeding edge, and create strong pressure for everyone to keep up, and that the answer to library compatibility is "wait until someone complains, fix the direct reason, cut a new release, and let the dependents fix their own code".
Python is a couple abstraction layers above that, it's not supposed to even be directly exposed to things that vary frequently between devices. That's a job of the OS, the C compiler, and the libraries (most of which just link to C ones anyway).
I don't think Python is perfect, I don't mind changes. But I do mind backward incompatible changes a lot.
Python is my main language and backward compatibility is far more important to me than performance.
Almost everything I do spends most of its time waiting for IO, or in a C library, or another process, or performance is unimportant. That is why Python is my main language.
I think it is possible that Python's popularity with people doing numerical stuff might end up making it worse for the rest of us.
I've been using Python since long before it became the go-to choice for numerics inside and outside academia, so let me tell you: It was even worse back then. The transition from 2.7 to 3.0 was both regarding the fundamental idea and the implementation the worst thing I have ever seen happen in any major language. This could (maybe should) have been a language killer. They should have just branched it out as something completely new. Van Rossum is totally right in saying that he never wants a Python 4 for that reason, so it seems at least he learned a little bit since then.
As systems started shipping Python 3, the convention among most of them became to leave `python` as a Python 2 interpreter and then introduce `python3` as a Python 3 interpreter. As they then stopped shipping Python 2, they generally just removed /usr/bin/python, so the only Python on the system was /usr/bin/python3.
In my own scripts to build Google stuff, I always had to make a folder with a single script called `python` which would contain just `exec python3 "$@"`, and then prepend that directory to the `PATH` when invoking Google's tools.
Google eventually did update their stuff to work on systems where the only Python is `python3`, but man this transition was rough. As I understand it, Google had good reason to do it their way at the time too; there was simply no consistency in how systems handled the 2 -> 3 switch. I suspect that this is due to a severe lack of guidance from the Python foundation.
Just because the BFDL doesn't increment the major version doesn't change the fact that myriad breaking changes arrive in Python 3 PEPs.
This is purely an optics hack. Python 3.0 is very different from Python 3.13. Had the frog not been boiled slowly, it might as well have been Python 4.
The people who could stop this churn will not. It's a full-employment ticket for them, chasing dot-release upgrades and educating us about changes that we couldn't live without but somehow did for decades.
It takes a big person to say when something is good enough despite its warts. Contrast the Python churn with Linux and git: never break user space.
A big attraction of Python is that it can do everything. Very useful if you need more than one of the above in a single project.
On the other hand I do feel that Python has been bad for my personal development because I can always find a Python library for any and everything it has reduced my motivation to learn other languages properly (i.e. actually using them for real work - I have learned a few in theory). I have been stuck with the same main (to the point of dominance!) language for far too long.
Yes, 2 to 3 was pretty painful, although it was not too bad for me because I was mostly able to delay moving until i was sure all the libraries I used had made the transition.
Survivorship bias. Python just barely survived the transition, and you only still use it now because it did make it. Take a look at Perl 6 to see a major language that failed.
It drives me _nuts_ when I find a simple library to do a small-ish thing that I don't want to write/maintain myself only to discover that it uses numpy or pandas because they're "fast".
Does it by any chance a process started by multiprocessing? /s.
On a serious note, I feel like this is a valid usage and as someone who really like the no-gil approach I still would want python to handle the gil and no-gil flags in a better way. I don't know yet how this will manifest in real life and if keeping gil will be an option on the long run but it is a trade-off. There is no fundamental reason why python cannot have proper multithreading support.
You don’t have to install the latest version if you don’t want to. If you use a version manager, you can keep using whatever version you want for many years.
i don't think it's too surprising that versions differ. there are good tools to manage the python version used -- i personally like pyenv.
+1
Most Python use case today is some what on the similar lines as Perl. Having a stable large install base. Availability of libraries, backwards compatibility, performance matter way more than more features at this point.
There is no new replacement language in sight, so Im guessing we will be using Python for long into the coming future.
I also hope Python had something on the lines similar to CPAN. We are decades into the journey, and Perl still shines like the Sun in this regard.
Part of me feels sad Perl 5 didn't go the way Python 3 did.
What prevents you from using an old Python version?
My current solution is a docker container which includes python 2.7 and a downloaded copy of every package I use.
I think the fact that it's not on the distributions is a major factor here.
With no python version manager (I don’t even know any off the top of my head).
Also virtualenvs only get you so far, I’ve come back to many projects on my machine with broken virtualenvs, I guess due to some dynamically linked dependency of python that my system no longer has.
:(
Try a tool called `pyenv`. It's pretty great. I pair it with the package manager called `poetry`.
Beside, "figure out which ones work" is a solved issue with a package manager such as poetry.
For such a long lived language to have this much immaturity is worrying. I guess the side affect of such popularity later in life.
I'm one of the people who was unkeen to move to Py3. My reason was mostly the numerous and totally unnecessary minor syntax changes (print -> function, map and filter becoming lazy, str/unicode etc) with no major benefits in the upgrade for my use case (data science), other than compatibility. Some of the new syntax was neither bad or good (what's so wrong with print being a statement? Add a printfn function if you really want one), some were IMHO outright bad (map and filter becoming lazy, reduce being kicked out to a module), str->unicode was maybe the only good one, but even that is controversial. The deliberate neutering of `bytes` was unnecessary too. Python 3 brought various implementation improvements and nice new syntax, which could have been implemented in a Python 2 syntax too (dict and set comprehensions for example)
So I saw no reason why Python 3 couldn't in fact be syntactically compatible with 2, and saw the whole thing as a bit of an upgrade circus: wanna keep using the language? Make these arbitrary changes because someone thought print ought to be a function.
You could argue it was the same disregard for stability as the now many versions of Python 3.
I use python3 now by default, as it has fstrings, and probably some iteration things that I now rely on, and is faster for a lot of things.
But for the longest time the only difference that I bumped into was that print isnt a keyword anymore, but assert still is.
I would never use Python 2 now, but I do understand why some people would choose 2 back when 3 was new (and even slower than 2!).
I wrote some python programs that did multithreading, but they didn't work and I had to go elsewhere.
So... it is possible you won't find many people in your sample that disagree because the folks that went elsewhere... aren't part of the sample.
Mature languages don’t tend to break working code. That was true when the quote was pronounced and that’s still true today.
Python is fairly unique in its propensity to be an unstable target. I personally can only think of the JS ecosystem has being worse but even then that’s mostly a library thing as the VM will run even the oldest JS code you can find. I wish the same could be said of Python.
I think running inference engines is one particular case of that. You can train and tweak your model using python with its wonderful pytorch and numpy. Then at some point when scale and performance matter then this becomes a potential problem.
Companies like Facebook also have huge interests in speeding up python as they have a lot of stacks written in python.
There was a consensus after the Python 3 debacle of “No major breaking changes”. We seem to have lost that because of moneyed interests and that’s sad.
To also enable this as default in the coming years is crazy.
I would love to hear what Guido thinks about this.
Basically it won't become a default until after it works. Which is the opposite of crazy; it's very reasonable.
Guido has spoken out on this and I don't think he's against this. It's more that he's in favor of stability and moving forward.
The challenge with python is that you can't do a lot of things in it very efficiently that people keep on doing in it anyway. Like trying to use multiple threads. Making those things work a bit better is not a bad thing.
There's a simple solution for code that depends on the GIL, which is simply to don't do what's fairly pointless with the GIL anyway: using more than 1 thread. The GIL only serves a purpose if you use more than 1 thread. And since it makes doing that kind of impractical anyway, most python code doesn't need the GIL because it is single threaded. That code will only break if the GIL is gone and multiple threads are used. Simple solution if that affects you: don't do that.
Also there's no way to get access to pypi and fix the abandoned libraries. So they get patched in distributions and remain broken forever on pypi.
That was certainly my experience working on TruffleRuby, and I doubt Python is very different. We found a few bugs because we didn’t have a global lock, but they were often problems that showed up in a soak test on an implementation with a GIL, just not quite as often so they had escaped notice and were likely causing real failures in production somewhere.
Everytime I've needed just a bit of multicore performance and have gotten stuck using multiprocessing sucks - I'd much prefer just to use threading and not worry about the pickling process.
https://www.infoworld.com/article/2338862/python-moves-to-re...
If your pure Python code fails without the GIL it can probably fail with the GIL, and testing it without the GIL might help you find those bugs a lot quicker.
No, if you remove the GIL there is a whole class of bugs that will appear in code that was safe with the GIL in place.
So if you're expecting something better than that, you will be disappointed.
I am pretty sure you are going to say there is a reason this cannot be done, would just like to know what it is!
To those who want to turn Python into Golang/Rust/Haskell/Java ... guys, other programming languages are available.
It’s common that as project grows larger and more unwieldy, people ask for more warranty and help from their tooling. I think Python position on this strikes a good balance - provide the infrastructure for adding type hint but delegates type checking to a third party.
Anything to avoid the over complexity associated with delivering content with nodejs it’s like you missed out on building your computational foundation.
As they are not enforced at runtime, you can easily return bollocks and not know.
I really like how c# does it, which is have strict typing on by default, but allowing you to turn it off for things where you're wanting to be loosey goosey. Not having to do a bunch of type checks on every operation would also speed up a bunch of things inside python
However, that would make it a different language. perhaps python 4? (ducks)
https://github.com/google/pytype https://github.com/google/pytype https://github.com/microsoft/pyright
Lisp compiles to native code since 1962, having a JIT is pretty much given.
I only mentioned Common Lisp, because of the wide library, having already the implementation experience of Lisp Machines from Xerox PARC, TI, Genera, and being as dynamic as Python if not more so, already to sidestep the usual dynamism excuse for lack of Python JIT's.