Question: Event driven programming

Chris Liechti cliechti at gmx.net
Sat Oct 27 23:59:25 CEST 2001


"Károly Ladvánszky" <aa at bb.cc> wrote in
news:3bdb0140_5 at corp-goliath.newsgroups.com: 

> What I have in my mind is not necessarily UI related. In VB, objects
> can raise events, objects interested in the events will handle them.
> Thats a very simple mechanism, facilitates easy coding in many
> situations, even if its just a console application with no GUI at all.
> They are similar to exceptions but they return to the caller and they
> can have parameters/return values of any kind.
> 

that sound like an "observer pattern" for me.... it is a common thing to do 
in OO languages. it's not a feature of a language but more a idea that can 
be implemented in various ways and languages.
Java has an observer pattern implementation in it library, for Python you 
can take the code from the URL below.

make a module with the "Subject" and "Observer" classes then you can simply 
inherit from them in your own classes.

here's an implemenation example:
http://mail.python.org/pipermail/python-list/2001-January/026166.html

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list