On Mon, Aug 21, 2017 at 5:14 PM, Koos Zevenhoven <k7ho...@gmail.com> wrote: [..] >> This has consequences for the design in the PEP: >> >> * what we want to capture at generator creation time is the context >> where writes will happen, and we also want that to be the innermost >> context used for lookups > > > I don't get it. How is this a consequence of the above two points? And why > do we need to capture something (a "context") at generator creation time? >
We don't need to "capture" anything when a generator is created (it was something that PEP 550 version 1 was doing). In the current version of the PEP, generators are initialized with an empty LogicalContext. When they are being iterated (started or resumed), their LogicalContext is pushed to the EC. When the iteration is stopped (or paused), they pop their LC from the EC. 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