In favor of ImplicitContext is one point: it is indeed "implicit" if you compare it with the "explicit" way of passing state around, which would require an extra argument containing the state for any function that uses the state *or calls a function that uses the state* (recursively).
On Wed, Aug 23, 2017 at 11:27 AM, Yury Selivanov <yselivanov...@gmail.com> wrote: > On Wed, Aug 23, 2017 at 12:56 PM, Antoine Pitrou <solip...@pitrou.net> > wrote: > > On Wed, 23 Aug 2017 12:19:40 -0400 > > Yury Selivanov <yselivanov...@gmail.com> wrote: > >> PEP 550 calls generators and asynchronous tasks as "logical threads", > >> and "logical context" stems directly from that notion. > > > > I wouldn't refer to a generator as a "thread" personally. A thread > > essentially executes without intervention from outside code, which is > > not the case for a generator (where resumption is controlled by > > explicit next() calls or iteration by the consumer). > > I agree. That's why we are rewriting the PEP without mentioning > "logical threads". > > > > > That is also why I proposed the more general "task" (and "task > > context"). Of course, capitalized "Task" is given a specific > > meaning by asyncio... > > Yeah.. I like TaskContext when it's applied to asynchronous code. It > doesn't really work for generators because we never refer to > generators as tasks. > > Out of what was proposed so far to replace Logical Context: > > 1. DynamicContext: close to "dynamic scoping", but tries to avoid > mentioning "scopes". There are only a few languages where dynamic > scoping is implemented, so people are generally not aware of it. > > 2. ContextFrame and all frame-related names: implies that EC is > somehow implemented on top of frames or is frame-specific (which is > not always true). > > 3. ImplicitContext: covers one specific property observed from > specific examples. Context in PEP 550 is managed explicitly in some > cases. There are many use cases when API users will be working with it > explicitly too (to wrirte/read data from it). FWIW I believe that > "ExplicitContext" would be more accurate than "ImplicitContext". > > 4. LocalContext: we use "local" to describe local variables and > scoping in Python, we want to avoid any confusion here. > > 5. TaskContext: works for asynchronous tasks, but not for generators. > > I don't think that replacing LogicalContext with any name in this list > will make any improvement. > > 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/ > guido%40python.org > -- --Guido van Rossum (python.org/~guido)
_______________________________________________ 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