On Wed, Sep 6, 2017 at 1:39 PM, Koos Zevenhoven <k7hoven at gmail.com> wrote: [..] > Now this was of course a completely fictional example, and hopefully I > didn't introduce any bugs or syntax errors other than the ones I described. > I haven't seen code like this anywhere, but somehow we caught the problems > anyway. Thank you for the example, Koos. FWIW I agree it is a "completely fictional example". There are two ways how we can easily adapt PEP 550 to follow your semantics: 1. Set gen.__logical_context__ to None when it is being 'yield frommmed' 2. Merge gen.__logical_context__ with the outer LC when the generator is iterated to the end. But I still really dislike the examples you and Greg show to us. They are not typical or real-world examples, they are showcases of ways to abuse contexts. I still think that giving Python programmers one strong rule: "context mutation is always isolated in generators" makes it easier to reason about the EC and write maintainable code. Yury
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