A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-September/149294.html below:

[Python-Dev] PEP 550 v4

[Python-Dev] PEP 550 v4Elvis Pranskevichus elprans at gmail.com
Thu Sep 7 09:41:10 EDT 2017
On Thursday, September 7, 2017 9:05:58 AM EDT Ethan Furman wrote:
> The disagreement seems to be whether a LogicalContext should be
> created implicitly vs explicitly (or opt-out vs opt-in). As a user
> trying to track down a decimal context change not propagating, I
> would not suspect the above code of automatically creating a
> LogicalContext and isolating the change, whereas Greg's context
> manager version is abundantly clear.
> 
> The implicit vs explicit argument comes down, I think, to resource
> management: some resources in Python are automatically managed
> (memory), and some are not (files) -- which type should LCs be?

You are confusing resource management with the isolation mechanism.  PEP 
550 contextvars are analogous to threading.local(), which the PEP makes 
very clear from the outset.

threading.local(), the isolation mechanism, is *implicit*.  
decimal.localcontext() is an  *explicit* resource manager that relies on 
threading.local() magic.  PEP 550 simply provides a threading.local() 
alternative that works in tasks and generators.  That's it!


                             Elvis
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4