Earlier quoted context omitted.
The GIL in an implementation detail of CPython, it's not part of Python the language.
It's been a while since I've followed Python closely but last I heard Python-the-language is de facto defined as "whatever CPython does". Has Python since grown a proper language specification?
The Changing "Guarantees" Given by Python's Global Interpreter Lock
51–60 of 142 posts
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#52Earlier quoted context omitted.
The GIL in an implementation detail of CPython, it's not part of Python the language.
AFAIK, there is no Python language specification, therefore implementation details of CPython IMO is the language.
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
#53It 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.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#54Earlier quoted context omitted.
It's been a while since I've followed Python closely but last I heard Python-the-language is de facto defined as "whatever CPython does". Has Python since grown a proper language specification?
Python doesn't have a full specification, but it does have first party documentation that distinguishes between CPython implementation details and language guarantees, in part to support alternative implementations.
This doesn't count?
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#55Code 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.
I dunno about that. There's a lot of Python out there with worker threads dumping their output into a shared "results" dict on the assumption that those insert operations are atomic.
For example, the following operations are all atomic (L, L1, L2
are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints):
L.append(x)
L1.extend(L2)
x = L[i]
x = L.pop()
L1[i:j] = L2
L.sort()
x = y
x.field = y
D[x] = y
D1.update(D2)
D.keys()Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#56Earlier quoted context omitted.
Python doesn't have a full specification, but it does have first party documentation that distinguishes between CPython implementation details and language guarantees, in part to support alternative implementations.
> Python doesn't have a full specification This doesn't count? https://docs.python.org/3/reference/index.html
> 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 up implementing quite a different language. On the other hand, if you are using Python and wonder what the precise rules about a particular area of the language are, you should definitely be able to find them here. If you would like to see a more formal definition of the language, maybe you could volunteer your time — or invent a cloning machine :-).
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#57It 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.
If you write a lot of code that parallelizes over data you will hurt all the time because of the GIL.
If you have worker processes that do something on the CPU, and the results need to be collected and processed further in some other process, you now need to pickle the data to copy it around. That can get really slow.
I understand a lot of python users don't do that kind of thing, but it's a real problem. I'm happy that the python community seems to be slowly beginning to take this seriously after decades of just claiming the GIL isn't a real issue.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#58Earlier quoted context omitted.
Python doesn't have a full specification, but it does have first party documentation that distinguishes between CPython implementation details and language guarantees, in part to support alternative implementations.
> Python doesn't have a full specification This doesn't count? https://docs.python.org/3/reference/index.html
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#59Earlier quoted context omitted.
The gil is a feature. Not using a feature that makes sense in our context is counter productive.
The GIL in an implementation detail of CPython, it's not part of Python the language.
Re: The Changing "Guarantees" Given by Python's Global Interpreter Lock
#60Earlier quoted context omitted.
Is there any versioning scheme that is comparable? Honest question.
Some languages just use integer versions, like Java.