On 10/23/05, Phillip J. Eby <pje at telecommunity.com> wrote: > Actually, you've just pointed out a new complication introduced by having > __context__. The return value of __context__ is supposed to have an > __enter__ and an __exit__. Is it a type error if it doesn't? How do we > handle that, exactly? Of course it's an error! The translation in the PEP should make that quite clear (there's no testing for whether __context__, __enter__ and/or __exit__ exist before they are called). It would be an AttributeError. > That is, assuming generators don't have enter/exit/context methods, then > the above code is broken because its __context__ returns an object without > enter/exit, sort of like an __iter__ that returns something without a 'next()'. Right. That was my point. Nick's worried about undecorated __context__ because he wants to endow generators with a different default __context__. I say no to both proposals and the worries cancel each other out. EIBTI. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
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