mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
simplfy code
This commit is contained in:
parent
8ad09a4f2e
commit
6060d5e3fa
1 changed files with 2 additions and 4 deletions
|
|
@ -158,10 +158,8 @@ def isgeneratorfunction(object):
|
||||||
Generator function objects provides same attributes as functions.
|
Generator function objects provides same attributes as functions.
|
||||||
|
|
||||||
See isfunction.__doc__ for attributes listing."""
|
See isfunction.__doc__ for attributes listing."""
|
||||||
if (isfunction(object) or ismethod(object)) and \
|
return bool((isfunction(object) or ismethod(object)) and
|
||||||
object.func_code.co_flags & CO_GENERATOR:
|
object.func_code.co_flags & CO_GENERATOR)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def isgenerator(object):
|
def isgenerator(object):
|
||||||
"""Return true if the object is a generator.
|
"""Return true if the object is a generator.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue