Message295475
| Author |
curtmcd |
| Recipients |
curtmcd, gvanrossum, mathieui, vstinner, yselivanov |
| Date |
2017年06月09日.01:12:12 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1496970733.02.0.132397672721.issue23519@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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'))) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年06月09日 01:12:13 | curtmcd | set | recipients:
+ curtmcd, gvanrossum, vstinner, mathieui, yselivanov |
| 2017年06月09日 01:12:13 | curtmcd | set | messageid: <1496970733.02.0.132397672721.issue23519@psf.upfronthosting.co.za> |
| 2017年06月09日 01:12:12 | curtmcd | link | issue23519 messages |
| 2017年06月09日 01:12:12 | curtmcd | create |
|