News for hackers. Stuff that matters.
Re:The Python Steering Council intent to approve PEP 703: ma... by willm on Friday July 28, 2023 @05:34PM (#36913671)
I'm looking forward to a GIL-less Python. I think the SC's pragmatic approach is the right one.
Re:The Python Steering Council intent to approve PEP 703: ma... by wolfspaw on Friday July 28, 2023 @05:31PM (#36913645)
No more lock: the Seal of Power will be Released.
Re:The Python Steering Council intent to approve PEP 703: ma... by mlryyc on Friday July 28, 2023 @05:33PM (#36913665)
Approve or don't approve. No other open source governance body has this kind of self importance and the desire for getting themselves in the news at all times.
Re:The Python Steering Council intent to approve PEP 703: ma... by dragonwriter on Friday July 28, 2023 @05:38PM (#36913714)
Approving a PEP isn’t just flipping a bit, there are other decisions which come with it; this is process transparency and, implicitly, calling for feedback relevant to those other bits.
Re:The Python Steering Council intent to approve PEP 703: ma... by mkl95 on Friday July 28, 2023 @05:44PM (#36913776)
Considering Python is probably the most popular language ever, I would say the members of the council keep a pretty low profile. There are declining languages with userbases orders of magnitude smaller that make the front page more often.
Re:The Python Steering Council intent to approve PEP 703: ma... by frfl on Friday July 28, 2023 @05:53PM (#36913871)
If I remember Guido van Rossum did mention the status of the GIL in one of the Lex Friedman episodes [1] he was on (it's been a while, so I may be misremembering). Surprised to see a big decision like this happen so quickly. Did Meta's announcement play a big role in this [2]?

[1]: https://www.youtube.com/watch?v=-DVyjdw4t9I

[2]: https://news.ycombinator.com/item?id=36643670

Re:The Python Steering Council intent to approve PEP 703: ma... by shosca on Friday July 28, 2023 @06:41PM (#36914358)
Anaconda also has committed engineering resources to assist with the no-GIL transition.
Re:The Python Steering Council intent to approve PEP 703: ma... by KRAKRISMOTT on Friday July 28, 2023 @06:07PM (#36914007)
Removing him as BDFL was probably the best thing to have happened to Python. He never prioritized performance as a top priority, at least not the same way Lua, JavaScript and Java did. Even Ruby has a JIT now.
Re:The Python Steering Council intent to approve PEP 703: ma... by ambivalence on Friday July 28, 2023 @06:16PM (#36914088)
You know that people change their minds and now Guido is working as part of a team at Microsoft that is literally called "Faster CPython"?
Re:The Python Steering Council intent to approve PEP 703: ma... by v3ss0n on Friday July 28, 2023 @07:13PM (#36914658)
Python had JIT for long, it's called PyPy, One of the most ambitious project ever happened to opensource
Re:The Python Steering Council intent to approve PEP 703: ma... by yjftsjthsd-h on Saturday July 29, 2023 @12:11AM (#36916817)
> Removing him as BDFL was probably the best thing to have happened to Python. He never prioritized performance as a top priority

That doesn't follow; you're assuming that Python should prioritize performance as a top priority, which is very much not a given. Python has always excelled at being easy to use, being flexible, being a great glue language - but performant? An interpreted, dynamically typed language? That's like making a C interpreter - you can do it, but that doesn't make it a good idea.

Re:The Python Steering Council intent to approve PEP 703: ma... by KRAKRISMOTT on Saturday July 29, 2023 @12:57PM (#36922141)
> An interpreted, dynamically typed language? That's like making a C interpreter - you can do it, but that doesn't make it a good idea.

And yet despite your complaints, JavaScript, Lua and Julia continue to rise in popularity.

Re:The Python Steering Council intent to approve PEP 703: ma... by yjftsjthsd-h on Saturday July 29, 2023 @01:45PM (#36922650)
I never said anything about popularity - Python is easily one of the most popular languages. But speed has never been its goal or strong point.
Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @06:00AM (#36918600)
His leadership & decision arbitration is dearly missing. Now we have decide by committee and as a result we see Python being pushed and pulled in all directions.
Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @05:56AM (#36918579)
It sure did. Also the decision was pretty much rushed through, if you follow the latest discussion (which got shut down on the notion that everything has been said and trust the SC and coredevs).

https://discuss.python.org/t/a-fast-free-threading-python/27...

Re:The Python Steering Council intent to approve PEP 703: ma... by tremon on Friday July 28, 2023 @06:48PM (#36914414)
I know they say specifically that they don't want a repeat of the Python3 transition scenario, but the approach they're taking now still veers eerily close to that path, at least it looks that way to me.

A lot will depend on the Python community and the distribution channels. I could see the community struggling to adopt it in a timely fashion, or distributions jumping the gun (Ubuntu, Fedora, Anaconda). Maybe it's too early to make hard decisions, but how much control does the SC really have to avoid such a scenario?

Re:The Python Steering Council intent to approve PEP 703: ma... by trwsxcn on Friday July 28, 2023 @07:01PM (#36914538)
Yes, it will resemble the 2to3 scenario. Corporations that pledge support will mechanically convert some projects (pestering the actual developers or threaten with forks?), bugs will be ironed out by the actual, unpaid developers over years.

But apparently Python needs some "success" and this makes a good bullet point. Correctness does not really matter in the Python world.

Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @02:56AM (#36917625)
Is it success though?
Re:The Python Steering Council intent to approve PEP 703: ma... by a_nop on Friday July 28, 2023 @09:28PM (#36915807)
They kind of burned a breaking major version transition for no good reason with 2-to-3, now they are prefacing a major change with "it won't be like 2-to-3". It sounds like they may be maintaining two operating modes in CPython 3 instead of going forward with another major transition, just because of that history.
Re:The Python Steering Council intent to approve PEP 703: ma... by jborean93 on Saturday July 29, 2023 @03:22AM (#36917760)
> They kind of burned a breaking major version transition for no good reason with 2-to-3

The unicode/text changes alone were a pretty good reason. Division producing floats are also a nice change IMO. I don’t want to discount the challenges with the transition but saying there was no good reason isn’t right to me.

Re:The Python Steering Council intent to approve PEP 703: ma... by rightbyte on Saturday July 29, 2023 @04:27AM (#36918137)
Not good enough reason then?
Re:The Python Steering Council intent to approve PEP 703: ma... by lozenge on Saturday July 29, 2023 @04:45AM (#36918234)
There were a lot of bad reasons as well. The removal of the u string prefix in versions 3.0-3.2 was unnecessary and made the transition much more difficult. It kind of gave Python 3 a bad reputation.
Re:The Python Steering Council intent to approve PEP 703: ma... by a_nop on Sunday July 30, 2023 @01:09AM (#36928024)
Unicode was absolutely a good change, the burn was the execution
Re:The Python Steering Council intent to approve PEP 703: ma... by gary_0 on Saturday July 29, 2023 @02:04AM (#36917394)
They say they want no-gil to be the only build mode 5 years from when it becomes available. That is both too long and too short.

That is too long for Python to have 2 modes. Half a decade is more than enough time for 2 modes to become the status quo. For one thing, think of all the outdated Stackoverflow threads that will be hanging around after that 5 years. I am not optimistic that 5 years won't turn into 10 years of uncertainty and breakage.

But 5 years might be too short for everyone to dredge up all that C code, update it, test it, and call it mature.

I guess we'll see.

Re:The Python Steering Council intent to approve PEP 703: ma... by toyg on Saturday July 29, 2023 @04:03AM (#36917991)
> 5 years might be too short for everyone to dredge up all that C code, update it, test it, and call it mature.

Developers are lazy. Most people will just do nothing until, 5 years from now, some blog post will go "oh, next month we switch noGil as default, good luck!". At that point everyone will scramble, rush out buggy releases, and spend 5 years finding all the problems.

Re:The Python Steering Council intent to approve PEP 703: ma... by lozenge on Saturday July 29, 2023 @04:44AM (#36918226)
The no-gil "build mode" will still have the ability to switch to GIL "run mode", it will just be slower than the GIL run mode on the GIL build mode. Hopefully not much slower.
Re:The Python Steering Council intent to approve PEP 703: ma... by mepian on Friday July 28, 2023 @07:48PM (#36914969)
I wonder if there will ever be Python 4, it seems that the core developers want to avoid bumping the major version number ever again after 3 under any circumstances.
Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @06:18AM (#36918692)
Yes bc they fear a Py3 to 4 transition would be perceived as a major burden.

I'm afraid we'll soon learn its not the version # that's burdensome, but the real or perceived(!) incompatibility between versions.

I wonder if introducing such a monumental change in a build flag of the minor version is really wise. Certainly its not in line with any interpretation of semantic versioning (to be fair I think the PSF does not claim to use that).

Re:The Python Steering Council intent to approve PEP 703: ma... by amluto on Friday July 28, 2023 @09:35PM (#36915861)
I’m not in love with some of the details.

PYTHONGIL is an awkward tri-state. 0, 1, and unset all do different things. Wouldn’t some self-explanatory strings be better? PYTHONGIL=auto for the default, force-gil and force-nogil for the forced modes.

Re:The Python Steering Council intent to approve PEP 703: ma... by m3kw9 on Saturday July 29, 2023 @12:50AM (#36917060)
What does this mean?
Re:The Python Steering Council intent to approve PEP 703: ma... by hgs3 on Saturday July 29, 2023 @01:07AM (#36917139)
Python uses a GIL (global interpreter lock) which prevents both Python code and native C modules from executing in parallel in the interpreter. Removing the GIL means Python could provide in-process parallelism.
Re:The Python Steering Council intent to approve PEP 703: ma... by dwaite on Saturday July 29, 2023 @01:45AM (#36917301)
I sure hope they decide to call execution of mixed GIL and no-GIL codebases "amphibious mode"
Re:The Python Steering Council intent to approve PEP 703: ma... by worik on Saturday July 29, 2023 @01:51AM (#36917334)
I am not a python programmer.

What is the use case for this?

Who needs it?

Re:The Python Steering Council intent to approve PEP 703: ma... by 12_throw_away on Saturday July 29, 2023 @05:29AM (#36918444)
> I am not a python programmer

I _am_ a python programmer.

> What is the use case for this?

> Who needs it?

This can be answered with a simple user story:

As "THE PYTHON STEERING COUNCIL",

I want to "GET RID OF THE GIL",

so that "PEOPLE WILL STOP WHINGING ABOUT THE GIL."

To be fair, there's another group of people who stand to benefit. Namely, any python programmers who currently believe that "threads are an easy way to make my program go faster" will soon be the recipients of a valuable learning experience.

Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @05:38AM (#36918489)
Nice!

;)

Re:The Python Steering Council intent to approve PEP 703: ma... by kgeist on Saturday July 29, 2023 @02:18AM (#36917451)
Is the following possible?

- library author marks their library "no-GIL" after making sure it's thread-safe without GIL

- if the interpreter sees this metainformation, it temporarily disables GIL for the current OS thread while running the library's code

- result: old versions of Python can still run no-GIL libraries under GIL, while new versions of Python allow to gradually remove GIL

Or it's not how CPython works?

Re:The Python Steering Council intent to approve PEP 703: ma... by BGINBarbarian on Saturday July 29, 2023 @02:25AM (#36917479)
Afaik, nogil will be a compile flag, which means that when there are two builds, you separately compile Gil and nogil builds. They will be two separate programs/binaries/packages. It could be possible for something like conda to install both binaries, then run your program with the one that matches the library flags, but python itself could not do this (afaik).
Re:The Python Steering Council intent to approve PEP 703: ma... by dotnet00 on Saturday July 29, 2023 @02:30AM (#36917505)
I'm looking forward to this, Python plays a fairly significant role in our scientific computing code and not having to have entirely separate processes will be very convenient for cutting down data duplication.
Re:The Python Steering Council intent to approve PEP 703: ma... by akdor1154 on Saturday July 29, 2023 @02:55AM (#36917621)
Get exc's happening!ited, it
Re:The Python Steering Council intent to approve PEP 703: ma... by lraxny on Saturday July 29, 2023 @03:07AM (#36917687)
The ruling class in python-dev are populists who are not threading experts. Python is run by the wrong people.

They will approve something if it serves a corporation. The submission here is likely CYA, so they can say that "they asked the community".

There is no appreciation for people doing grassroots open source software. If Instagram can add another hack instead of switching to Java, it will be approved.

It is important to remember that paid corporate developers will have job security every time new pain is introduced in the Python ecosystem.

Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @06:05AM (#36918627)
I have the same impression though I think its not intentional or otherwise ill intended.
Re:The Python Steering Council intent to approve PEP 703: ma... by hanselot on Saturday July 29, 2023 @03:13AM (#36917720)
for self in selfs:
Re:The Python Steering Council intent to approve PEP 703: ma... by JonChesterfield on Saturday July 29, 2023 @03:14AM (#36917722)
Exciting. Python is mostly written as C shared libraries that knew they had a global lock to rely on.

Some of those do sufficiently simple things that they can run without any locking and all will be fine.

Others will still need locking, but are now under pressure to run without the gil. Some of those are going to do DIY locking within their own bounds.

Maybe what python has really been missing all these years is loads of ad hoc mutex calls scattered across the ecosystem. Data races and deadlocks introduced in the name of performance is not how I expected python to go out.

edit: expanding on this pessimism a bit.

Making C libraries written assuming a global lock thread safe is the sort of thing I'd expect concurrency experts to advise against and then make mistakes while implementing it. My working theory is that most people who wrote C extensions for python are not concurrency experts and are great programmers who won't back down from a challenge.

The data-race/hang/segfault consequences of this combination look totally inevitable to me. Python application developers are not going to love the new experience and I'm thankful my products are not built on top of the python ecosystem.

Re:The Python Steering Council intent to approve PEP 703: ma... by tgv on Saturday July 29, 2023 @03:59AM (#36917961)
I think you're right. Making it an explicit opt-out, as is planned for the first stage, should be fine. Expecting to make it opt-in in 5 years seems too optimistic to me. It relies on all the library developers to fix their libraries (also the Python ones). That's tough work, and importantly, if done well, it will even go unappreciated: nobody will notice it.

Many libraries have never had a multi-processing use case, others are so big that bugs are bound to happen, many of them subtle, so one guaranteed outcome will be unreproducible complaints and devs throwing in the towel. Opt-in will make people unhappy.

Re:The Python Steering Council intent to approve PEP 703: ma... by Arbortheus on Saturday July 29, 2023 @06:34AM (#36918788)
Surely if it goes well people will see their existing python codebases become more performant with no development required aside from updating some dependencies? Not nobody will notice it.

It seems like it could be a great outcome for developers.

Re:The Python Steering Council intent to approve PEP 703: ma... by tgv on Saturday July 29, 2023 @01:01PM (#36922193)
So, removing the GIL will slow down Python, at least initially. Speed gains from multi-threading won't come if you don't change your code, unless you happen to use a library that becomes multi-threaded (in which case you have to start worrying about callbacks).

> It seems like it could be a great outcome for developers.

For the ones that use certain libraries, not for those that have to build them.

Re:The Python Steering Council intent to approve PEP 703: ma... by xmcqdpt2 on Saturday July 29, 2023 @07:06AM (#36919007)
Most C libraries that are often called from python also have bindings for other languages and so at this point should be threadsafe, right? Also even GIL python supports threads so all these libraries will at least be reentrant safe already.

For libraries that are reentrant but not thread safe, it should be sufficient to just add a global lock wrapping every call, which is pretty close to what the GIL was doing anyway.

It seems to me that in many (most?) cases it should be relatively straightforward to make existing libraries work without the GIL (at the cost of parallelism). I guess the main issue will be for libraries that call back into the python runtime from the C side.

Re:The Python Steering Council intent to approve PEP 703: ma... by elisbce on Saturday July 29, 2023 @03:34AM (#36917815)
Seems these guys never learn from the Python 2 -> 3 mess. GIL to NoGIL is even worse. Most changes from Python 2 to 3 are syntactic, but GIL to NoGIL could require a complete redesign and rewrite. Either it takes another 10+ years migrating OR nobody with a realistic production codebase with 10k dependencies can turn this No-GIL thing on.
Re:The Python Steering Council intent to approve PEP 703: ma... by ksec on Saturday July 29, 2023 @03:57AM (#36917952)
It will be interesting to see how this will be executed. I think many in Ruby land wanted something similar but couldn't get some general agreement. Ractors tried and arguably failed. We have Samuel Williams basically the one person pushing very hard for Async changes.

Ruby could learn a lot once this is done, but at the moment GIL optional in python seems to be a 2030 goal.

Re:The Python Steering Council intent to approve PEP 703: ma... by birdyrooster on Saturday July 29, 2023 @03:57AM (#36917953)
Soon I’ll be able to ditch golang
Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @05:39AM (#36918491)
Right about ~2033
Re:The Python Steering Council intent to approve PEP 703: ma... by samsquire on Saturday July 29, 2023 @04:32AM (#36918166)
Thank you so much Python core developers and steering council. Python is one of my favourite languages along with Java and C.

I greatly welcome true multithreading in Python.

I use both multiprocessing and multithreading in Python for different projects. See [0] for my multiprocessing example and python Threads for IO heavy tasks in [1]. But it would be far more efficient to use true threads.

Threads can communicate any amount of data in a single atomic almost instant operation. Using the local loopback interface or multiprocessing or pipes, this is not possible.

I am working on a multithreading architecture I call three tier multithreading architecture

https://github.com/samsquire/three-tier-multithreaded-archit...

My goal is extremely scalable and performant servers but Python is probably the wrong job for that.

[0]: https://news.ycombinator.com/item?id=36897054 (my description of my use of multiprocessing) [1]: https://devops-pipeline.com/ (my use of multithreading)

Re:The Python Steering Council intent to approve PEP 703: ma... by fulafel on Saturday July 29, 2023 @05:12AM (#36918363)
How will this impact single thread performance?
Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Saturday July 29, 2023 @05:50AM (#36918554)
From the POC implementation the reports state ~5-7% if memory serves right.
Re:The Python Steering Council intent to approve PEP 703: ma... by kerkeslager on Saturday July 29, 2023 @12:44PM (#36922002)
Two major problems here:

1. There are some improvements worth breaking reverse-compatibility for, and removing the GIL is such an improvement. Whether the changes in Python 3 were worth making breaking changes for is debatable: certainly I don't see "print" being a function as particularly valuable. But the flipside is that the 2-to-3 transition was overblown by a vocal minority. I've transitioned more than 5 codebases from 2 to 3, and in most cases, there were few problems. Most problems were with codebases where previous developers had pulled in libraries for everything, resulting in an amalgamation of abandoned libraries, but these codebases run into problems even without the core language breaking compatibility. The answer isn't to flame your language into never breaking compatibility, it's to not import all of pip and expect that to be a sustainable strategy.

The situation we have now is that the steering committee has received so much heat from the vocal minority that they're terrified to make breaking changes. But removing the GIL should be a breaking change. It's too fundamental to how Python works to not be. So they're trying to remove the GIL and make it not a breaking change, which is a bad idea, because it is ultimately going to be a breaking change. It would be much better to admit this is a breaking change and start working on the transition plan, than to try the impossible task of making it not breaking because you're too terrified of your users to admit the truth.

We've already seen this in Python 3.11 which broke code in my codebase. The changes to fix the breakage weren't hard, but I would have liked better communication that this might happen. But I also understand why this was hidden in a deprecation warning in a minor release rather than publicized, because the Python team is probably tired of being flamed for making breaking changes.

2. The more fundamental problem here is that a lot of other features of Python were built around the GIL. Most obviously, the async paradigms makes sense largely because of the GIL. Sans-GIL, it looks like in retrospect a send/recv actor model a la Erlang would have been a much better way forward. It's not really possible to reverse this, and this might be pushing Python toward a less cohesive set of features that don't really make sense together. This makes it feel like this is too little too late.

Re:The Python Steering Council intent to approve PEP 703: ma... by miraculixx on Sunday July 30, 2023 @08:03AM (#36930319)
The creator and lead maintainer of SQLAlchemy, one of the most popular and most used Python library for accessing databases (who doesn't?) gave a rather interesting response to PEP703.

If this doesn't ring any alarm bells I don't know what will.

> Basically for the moment the GIL-less idea would likely be burdensome for us and the fact that it's only an "option" seems to strongly imply major compatibility issues that we would not prefer.

https://github.com/sqlalchemy/sqlalchemy/discussions/10002#d...