[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #7597 [Stem]: Send arbitrary parameters to functors



#7597: Send arbitrary parameters to functors
-------------------------+--------------------------------------------------
 Reporter:  robinson     |          Owner:  atagar
     Type:  enhancement  |         Status:  new   
 Priority:  normal       |      Milestone:        
Component:  Stem         |        Version:        
 Keywords:  events       |         Parent:  #7328 
   Points:               |   Actualpoints:        
-------------------------+--------------------------------------------------

Comment(by atagar):

 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)
 }}}

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7597#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs