[Python-Dev] Proposed changes to PEP 343
Nick Coghlan
ncoghlan at gmail.com
Fri Oct 7 16:16:20 CEST 2005
Michael Hudson wrote:
> <nit>
> 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.
> </nit>
Fair point :)
> Seems a bit magical to me, but haven't thought about it hard.
Same here - I'm just starting to think that the alternative is worse, because
it leaves open the nonsensical possibility of writing a __with__ method as a
generator *without* applying the contextmanager decorator, and that would just
be bizarre - if you want to get an iterable, why aren't you writing an
__iter__ method instead?
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.blogspot.com
More information about the Python-Dev
mailing list