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 return a coroutine rather than change the 
stdlib for that.

In the attached file is an example of such use, where EventNotifier is a 
Protocol which receives external events and triggers event handlers based on 
that, and where the add_event_handler function checks if the handler is a 
coroutine function. In which case it uses asyncio.async to schedule the handler 
call; otherwise it uses loop.call_soon.

You can close this, I guess.

----------
Added file: http://bugs.python.org/file38246/example_partial.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23519>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to