It seems like in every python discussion I hear people complain about the GIL. I’m happy people are working on removing the GIL, but As a professional python dev for about 5 years now I have literally never had a problem where the GIL was a limiter. Although I just make web apps so maybe I’m not the target audience.
The Changing "Guarantees" Given by Python's Global Interpreter Lock
71–80 of 142 posts
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#72Why does Python use an un-comparable version number scheme? Not being a Python programmer, comparing version 3.9 to 3.13 seemed bizarre until I caught on.
Is there any versioning scheme that is comparable? Honest question.
3.10 and 3.9 are perfectly mechanically comparable (meaning one can write a program to deterministically compare them and return their relative order), just not with default numeric ordering (then again they're not numbers, they are composite values that are comprised by numbers) or naive string based ordering.
If we wanted trivially comparable with regular numeric ordering we could have incremental numbers as versions. 1, 2, 3, ...
And if we wanted string ordering (as with usual filesystem listing sorting with no extra flags to treat as numbers), we could have fixed length padded parts: 00001.00045.
Not sure if the latter is used, but some software does use the first.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#73The brief blurb about how GIL came to be, in light of Python’s success as a language and a tool, makes me question my s/e belief system. Things like this are like when good things happen to bad people and bad things happen to good people. It makes you question the meaning of it all. Is there no great architect in the sky? Is there no software god after all, looking down, punishing sloppy engineers and granting blessi…
While there is some truth in what you are saying, you have a common misunderstanding of the situation. Part of the reason the GIL has proved so difficult to remove is that it is actually a good solution. In fact, there have been multiple largely successful attempts to remove it over time over the entire range of aggressiveness from CPython changes to writing an entire JIT stack (PyPy), but it has never gone in to CPy…
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#74Earlier quoted context omitted.
> Python doesn't have a full specification This doesn't count? https://docs.python.org/3/reference/index.html
The introduction section states that it's not a complete/exact specification. If you're using a Python implementation and have a question, this should answer it. If you're writing a Python implementation and have a question, this may not answer it. > Consequently, if you were coming from Mars and tried to re-implement Python from this document alone, you might have to guess things and in fact you would probably end u…
Yes, I know that statement is in the Introduction, but I think it's rather ill-considered. If my implementation is consistent with the language reference, on what grounds would someone claim it was not an implementation of Python but a "different language"?
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#75Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#76Code that assumes that something is going to be atomic because of the GIL (or any other implementation detail) is simply broken. If you need something to be atomic you should be explicit about that and use mutex or something.
IOW, the python implementation is the standard, and therefore any code that relies on an implementation detail in the reference implementation is, by definition, correct.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#77Earlier quoted context omitted.
AFAIK, there is no Python language specification, therefore implementation details of CPython IMO is the language.
> AFAIK, there is no Python language specification Yes, there is: https://docs.python.org/3/reference/index.html This specification does not mention the GIL anywhere, which means it is, as the GP said, an implementation detail. Other implementations of Python that do not have the GIL are still "Python" implementations because they meet this language specification.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#78Code that assumes that something is going to be atomic because of the GIL (or any other implementation detail) is simply broken. If you need something to be atomic you should be explicit about that and use mutex or something.
For a sufficiently popular project there are often cases where users (other projects) rely on existing observed behavior even if it not guaranteed by documentation/specification.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#79Earlier quoted context omitted.
True, but when a majority of ecosystem is relying on an implementation detail, that implementation detail becomes de-facto standard.
Just because everybody does something the wrong way doesn’t somehow make it magically correct. One study [1] in the US released in 2020 found almost 90% of people admitted to speeding, but I don’t think anyone would say that speeding is now approved by the authorities and consequence-free. [1] https://www.thezebra.com/resources/research/speeding-car-ins...
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#80Earlier quoted context omitted.
I would say that that is intended as documentation for users (includong implementors of tools targeting the language), not a specification for implementors of Python, but I would agree that it is largely usable in either role; my point in the GP was that something distinct called “the Python Language Specification” doesn't exist, but that a (not necessarily complete, from a language implementors perspective) specific…
> not a specification for implementors of Python I don't see why not. The "Introduction" section specifically mentions different implementations and distinguishes implementation details, which can vary by implementation, from the language reference itself, which defines what every implementation has to meet to be considered an implementation of the Python language. > my point in the GP was that something distinct cal…
Not sure why there is an argument here.