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

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Dec 1 06:17:56 UTC 2012


#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


More information about the tor-bugs mailing list