[Python-Dev] Proposed changes to PEP 343
mwh at python.net
Fri Oct 7 15:02:12 CEST 2005
Nick Coghlan <ncoghlan at gmail.com> writes:
> What if we simply special-cased the __with__ slot in type(), such that if it
> is populated with a generator object, that object is automatically wrapped
> using the @contextmanager decorator? (Jason actually suggested this idea
You don't want to check if it's a generator, you want to check if it's
a function whose func_code has the relavent bit set.
Seems a bit magical to me, but haven't thought about it hard.
I think my standards have lowered enough that now I think ``good
design'' is when the page doesn't irritate the living fuck out of
me. -- http://www.jwz.org/gruntle/design.html
More information about the Python-Dev