[Tutor] function signatures for callbacks

Don Taylor nospamformeSVP at gmail.com
Fri Mar 24 21:29:56 CET 2006


Danny Yoo wrote:

> 
> ###########################################################
> ## Pseudocode for sending 'x' to every listener (untested)
> class CallbackError(Exception):
>     pass
> 
> for l in self.listeners:
>     try:
>         l(x)
>     except Exception, e:
>         raise CallbackError, ("%s failed" % l.__name__, e)
> ###########################################################
> 
Danny:

Ok I tried this and it is good.

I don't think that I need the _internal_shout anymore as this code 
already wraps the exception handling and I can decide what I want to 
display in the above except statement.

Unless I am missing something?

Thanks again,

Don.



More information about the Tutor mailing list