A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-May/065362.html below:

[Python-Dev] feature request: inspect.isgenerator

[Python-Dev] feature request: inspect.isgenerator [Python-Dev] feature request: inspect.isgeneratorFredrik Lundh fredrik at pythonware.com
Mon May 29 21:57:43 CEST 2006
Terry Reedy wrote:

>> def isgenerator(func):
>>    return func.func_code.co_flags == 99
>>
>> but it is rather ugly (horrible indeed).
> 
> To me, part of the beauty of Python is that is so easy to write such things 
> so compactly, so that we do not need megaAPIs with hundreds of functions 
> and methods.

so what's so "easy" about the magic constant 99 ?

is there some natural and obvious connection between generators and that 
number that I'm missing, or is that constant perhaps best hidden inside 
some introspection support module?

(I'm still not sure about the use case, though.  shouldn't a program 
treat a generator just like any other callable that returns an iterator?)

</F>

More information about the Python-Dev mailing list

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