Send arbitrary parameters to functors
In event-handling it would be nice to include custom parameters to pass to the receiving functor.
Trac:
Username: robinson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
- Show closed items
Link issues together to show that they're related.
Learn more.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
Hi robinson. Wouldn't it be better to use a partial rather than having the Controller track the extra arguments?
import functools def listener(channel, event): channel.send(event) chan1, chan2 = Pipe() with Controller as controller: controller.authenticate() controller.add_event_listener(funtools.partial(listener, chan1), [CIRC, STREAM]) time.sleep(5)
Replying to atagar:
Wouldn't it be better to use a partial rather than having the Controller track the extra arguments?
Yes, it would. I keep forgetting about partial. I'm closing this ticket as not a bug.
Trac:
Username: robinson
Resolution: N/A to not a bug
Status: new to closed- Trac closed
closed
Please register or sign in to reply