[New-bugs-announce] [issue4795] inspect.isgeneratorfunction inconsistent with other inspect functions
Steven D'Aprano
report at bugs.python.org
Wed Dec 31 23:47:07 CET 2008
New submission from Steven D'Aprano <steve at pearwood.info>:
The inspect isSOMETHING() functions all return True or False, except
for isgeneratorfunction(), which returns True or None.
The body of the function is very brief:
if (isfunction(object) or ismethod(object)) and \
object.func_code.co_flags & CO_GENERATOR:
return True
The behaviour can be made consistent with the other routines by either
appending "else: return False", or changing the body to:
return bool(
(isfunction(object) or ismethod(object)) and
object.func_code.co_flags & CO_GENERATOR)
----------
components: Library (Lib)
messages: 78661
nosy: stevenjd
severity: normal
status: open
title: inspect.isgeneratorfunction inconsistent with other inspect functions
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4795>
_______________________________________
More information about the New-bugs-announce
mailing list