[Python-Dev] PEP 550 v4

Yury Selivanov yselivanov.ml at gmail.com
Mon Aug 28 13:04:15 EDT 2017


On Mon, Aug 28, 2017 at 12:43 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 08/28/2017 09:12 AM, Yury Selivanov wrote:
>
>> If we forget about dynamic scoping (I don't know why it's being brought up
>> all the
>> time, TBH; nobody uses it, almost no language implements it)
>
>
> Probably because it's not lexical scoping, and possibly because it's
> possible for a function to be running with one EC on one call, and a
> different EC on the next -- hence, the EC it's using is dynamically
> determined.
>
> It seems to me the biggest difference between "true" dynamic scoping and
> what PEP 550 implements is the granularity: i.e. not every single function
> gets it's own LC, just a select few: generators, async stuff, etc.
>
> Am I right?  (No CS degree here.)  If not, what are the differences?

Sounds right to me.

If PEP 550 was about adding true dynamic scoping, we couldn't use it
as a suitable context management solution for libraries like decimal.
For example, converting decimal/numpy to use new APIs would be a
totally backwards-incompatible change.

I still prefer using a "better TLS" analogy for PEP 550.  We'll likely
add a section summarizing differences between threading.local() and
new APIs (as suggested by Eric Snow).

Yury


More information about the Python-Dev mailing list