[Tutor] function signatures for callbacks

Don Taylor nospamformeSVP at gmail.com
Tue Mar 21 21:13:01 CET 2006

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 = pawprints(callback_fun = printme)

My questions:

1) Is this the correct way to do this (the code does seem to work OK).

2) If so, then is there a way to specify the function signature at 
callback site rather than the client site?

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.



More information about the Tutor mailing list