On Sat, Aug 26, 2017 at 1:23 PM, Ethan Furman <et...@stoneleaf.us> wrote: > On 08/26/2017 09:25 AM, Yury Selivanov wrote: >> >> On Fri, Aug 25, 2017 at 10:19 PM, Ethan Furman 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. > > > A good point; however, ChainMap, which behaves similarly as far as lookup > goes, uses "get" and does not have a "lookup" method. I think we lose more > than we gain by changing that method name.
ChainMap is constrained to be a Mapping-like object, but I get your point. Let's see what others say about the "lookup()". It is kind of an experiment to try a name and see if it fits. Yury _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com