[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2017-06-08 Thread Guido van Rossum
Guido van Rossum added the comment: Use a lambda instead of partial. It's more pythonic. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2017-06-08 Thread Curt McDowell
Curt McDowell added the comment: There are use cases for this. I hit the problem and eventually wound up here, so I'd like to make a case to re-open. My project has a callback registry of asyncio handler routines. register_callback(condition1, handler1) register_callback(condition2, handler2)

[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2015-02-26 Thread Guido van Rossum
Guido van Rossum added the comment: Yeah, your "add event handler" routine shouldn't be so picky to insist that iscoroutinefunction() returns True. It should just call the thing and verify that it has returned a coroutine object (asyncio.iscoroutine()). -- resolution: -> not a bug sta

[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2015-02-26 Thread Mathieu Pasquet
Mathieu Pasquet added the comment: Using functools.partial with coroutines would be mostly out of convenience, in order to avoid having factories in that return parametrized coroutine functions. I guess in such cases it might be better to create a two-lines wrapper around partial() to make it

[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2015-02-26 Thread STINNER Victor
STINNER Victor added the comment: > Plus there is no use case. Mathieu: can you maybe give some examples? How are you using functools.partial with coroutines? -- ___ Python tracker ___

[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2015-02-25 Thread Guido van Rossum
Guido van Rossum added the comment: I recall discussing this before (maybe on the tulip list). I am firmly against. It is a slippery slope -- why inspect a partial but not a lambda? Plus there is no use case. -- ___ Python tracker

[issue23519] using asyncio.iscoroutinefunction() on a functools.partial object

2015-02-25 Thread Mathieu Pasquet
New submission from Mathieu Pasquet: Using iscoroutinefunction() on an object returned by functools.partial() should return True if the function wrapped was a coroutine function. (a recursive loop like the one in asyncio/events.py get_function_source() may be what needs to be done) --