Re: Events: The Python Way

2007-07-30 Thread kyosohma
On Jul 29, 3:14 pm, "Gianmaria" <[EMAIL PROTECTED]> wrote: > "David Wilson" <[EMAIL PROTECTED]> ha scritto nel messaggionews:[EMAIL > PROTECTED] > > > > > Hi there, > > > Python has no built-in way of doing this. You may consider writing > > your own class if you like this pattern (I personally do

Re: Events: The Python Way

2007-07-29 Thread Gianmaria
"David Wilson" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > Hi there, > > Python has no built-in way of doing this. You may consider writing > your own class if you like this pattern (I personally do): > > class Event(object): >def __init__(self): >self.subscri

Re: Events: The Python Way

2007-07-28 Thread Antti Rasinen
On 2007-07-29, at 02:34, David Wilson wrote: > Hi there, > > Python has no built-in way of doing this. You may consider writing > your own class if you like this pattern (I personally do): > > class Event(object): > def __init__(self): > self.subscribers = set() ... > def __isub

Re: Events: The Python Way

2007-07-28 Thread David Wilson
Hi there, Python has no built-in way of doing this. You may consider writing your own class if you like this pattern (I personally do): class Event(object): def __init__(self): self.subscribers = set() def __iadd__(self, subscriber): self.subscribers.add(subscriber)