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)
...
I want to register many callbacks, but use only one handler and an argument to
differentiate it. I realize our callback systems should provide for a cookie,
but it doesn't.
register_callback(condition1, functools.partial(handler, 'detail1'))
register_callback(condition2, functools.partial(handler, 'detail2'))
The callback registry makes sure iscoroutinefunction(handler) because we don't
want to defer error checking to the distant future. But iscoroutinefunction()
returns False for the partial function. I was hopeful that this might work, but
alas, no:
register_callback(condition1,
asyncio.coroutine(functools.partial(handler, 'detail1')))
----------
nosy: +curtmcd
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23519>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com