Re: [Tutor] function signatures for callbacks

2006-03-24 Thread Danny Yoo
> 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? Yup, nope. *grin* That was just there to sho

Re: [Tutor] function signatures for callbacks

2006-03-24 Thread Don Taylor
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 CallbackErr

Re: [Tutor] function signatures for callbacks

2006-03-24 Thread Danny Yoo
On Fri, 24 Mar 2006, Don Taylor wrote: > When I first read your response I did not see how it helped me, but now > I realise that it allows me to add some context to the exception message. > > I don't suppose that I can change the traceback to point at the > definition of f2 instead of shout() b

Re: [Tutor] function signatures for callbacks

2006-03-24 Thread Don Taylor
Danny: Thanks for this, I think that I can use this idea. When I first read your response I did not see how it helped me, but now I realise that it allows me to add some context to the exception message. I don't suppose that I can change the traceback to point at the definition of f2 instead o

Re: [Tutor] function signatures for callbacks

2006-03-21 Thread Danny Yoo
> > It seems backwards to me because because if I get the function > > definition wrong in the client site then I get a traceback to the > > callback site - which is meant to be an opaque library that the client > > should not have to know about. > > Yes, what you're asking makes sense: we want to

Re: [Tutor] function signatures for callbacks

2006-03-21 Thread Danny Yoo
> I have a piece of code that wants a callback from a client: > > The code looks like this right now: > > class pawprints: > def __init__(self, callback_fun = None) > ... > > > at the client calling site I have something like this: > > def printme(modulename, codename, lineno, line)

[Tutor] function signatures for callbacks

2006-03-21 Thread Don Taylor
I have a piece of code that wants a callback from a client: The code looks like this right now: class pawprints: def __init__(self, callback_fun = None) ... at the client calling site I have something like this: def printme(modulename, codename, lineno, line): ... paws = pa