[Baypiggies] introspecting for generator vs non-generator function
matt at matt-good.net
Sat Nov 15 04:44:12 CET 2008
On Nov 14, 2008, at 4:07 PM, Alex Martelli wrote:
> Just in case anybody's interested, please see
There's a co_flags for that:
"The following flag bits are defined for co_flags: ... bit 0x20 is set
if the function is a generator."
return bool(func.func_code.co_flags & 0x20)
I also tried posting a comment, but maybe it's awaiting moderation.
More information about the Baypiggies