Monday, December 1, 2008

Inside zope.event

The zope.event Python package is extremely straightforward. Which is why I like it. It provides a publish-subscribe mechanism that is sufficient for most applications. The entire zope.event package consists of a list for storing subscribers and a single notify function to publish events. Here is what the module looks like.

subscribers = []

def notify(event):
for subscriber in subscribers:
Very handy functionality and very easy to understand. This could event be implemented within an application should the zope.event module not be available because of its' simplicity.

No comments :

Post a Comment