[Python-Dev] Oberver Pattern

Raymond Hettinger python@rcn.com
Tue, 14 May 2002 20:27:17 -0400

From: "Greg Ewing" <greg@cosc.canterbury.ac.nz>
> Having thought it through a bit more, you're probably
> right. I just thought it might appeal to Magnus, since
> he seems to be fond of lots of layers of magic, without
> much if any regard for performance...

FWIW, the early results from my test implementation is
that there is no measurable performance impact if
an observer function has not been attached or if
the observer function is a short C call (perhaps
setting a flag or logging the object id).  The only way to 
slow it down enough for the timer to notice seems to be 
attaching a pure python function to be notified.

IOW, the observer pattern doesn't slow you down until
you need it.  And, if you need it, then you're probably
doing it to save much more time being spent on repeated
checks to see if a change has taken place and to save
programmer effort by de-coupling the objects.

BTW, Magnus rules.
i-haven't-forgotten-+1-votes-on-generator-enhancements-ly yours <wink>,

Raymond Hettinger

_ ~
@ @