instance creatiion as an "event"
Simon Burton
simonb at webone.com.au
Fri Apr 11 19:20:05 EDT 2003
On Fri, 11 Apr 2003 17:15:32 -0400, Arthur wrote:
> I am trying to re-engineer, as lightly as possible, a Python app I
> wrote, to be make it more functional when used at the interactive prompt.
>
> The only thing I seem to be missing is some kind of "hook" to trigger a
> general update cycle of all existing class instances upon the creation
> of a new class instance at the interactive prompt
>
class Member:
members = []
def __init__(self):
for m in Member.members:
m.notify(self)
Member.members.append(self)
def notify(self,other):
print self,"a new member:",other
#Just an idea,
#
#Simon Burton.
More information about the Python-list
mailing list