Properties, Methods, Events

Courageous jkraska1 at san.rr.com
Tue May 8 11:42:10 EDT 2001


>Following on from your example, it's trivial to make an Events mixin that
>maybe contains a dictionary mapping event-names to a list of event-handlers.
>If an event-handler is present, it can be automatically invoked by the
>__setattr__ method. But, this only applies to _get_ and _set_ events.

You don't really want to do this; you need to have a subscription model,
otherwise you'll be faced with a heavy duty scaleability problem  that even
Python will notice. To wit:  if every object you instantiate has to check its own
dictionary to see if it has a handler for the event, you've got a potential
scaleability problem; a simple message/ack round will scale O(n^2).

Furthermore, if distance matters, you'll probably want to come up with
some event delivery mechanism that is distance-aware and based on
known geometric optimization techniques.

You'll get better mileage out of a subscription/event delivery manager
of some kind, IMO.



C//




More information about the Python-list mailing list