[issue29987] inspect.isgeneratorfunction not working with partial functions

Martin Panter report at bugs.python.org
Wed Apr 5 04:49:12 EDT 2017


Martin Panter added the comment:

Not in general. I think you would have to make special cases for partial functions, __wrapped__, and whatever else there is, and combinations of these. It would be very hard to determine the correct result for test2 in

test2 = lambda: test(a=10)  # test2() returns a generator

def test(a):
    '''Redefined as a non-generator!'''
# Now test2() returns None

Maybe there is an argument for supporting partial as a new feature, but I don’t think it is a bug. I think there is precedent with the inspect.getargspec etc.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29987>
_______________________________________


More information about the Python-bugs-list mailing list