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-August/148966.html below:

[Python-Dev] PEP 550 v4

[Python-Dev] PEP 550 v4Yury Selivanov yselivanov.ml at gmail.com
Sat Aug 26 12:25:24 EDT 2017
On Fri, Aug 25, 2017 at 10:19 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> All in all, I like it.  Nice job.

Thanks!

>
> On 08/25/2017 03:32 PM, Yury Selivanov wrote:
>
>> A *context variable* is an object representing a value in the
>> execution context.  A new context variable is created by calling
>> the ``new_context_var()`` function.  A context variable object has
>> two methods:
>>
>> * ``lookup()``: returns the value of the variable in the current
>>    execution context;
>>
>> * ``set()``: sets the value of the variable in the current
>>    execution context.
>
>
> Why "lookup" and not "get" ?  Many APIs use "get" and it's functionality is
> well understood.

ContextVar.set(value) method writes the `value` to the *topmost LC*.

ContextVar.lookup() method *traverses the stack* until it finds the LC
that has a value.  "get()" does not reflect this subtle semantics
difference.

Yury
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