python vs. lisp (whereis quote?)

Alex alex at somewhere.round.here
Tue Jul 20 16:18:35 EDT 1999


Perhaps you can define a do-nothing function that you can then change
behind the module's back:

hook.py:
------------------------------------------------------------------------
def hook(*args):pass

def actual_program(*args):
    return apply(hook,args)
------------------------------------------------------------------------

Python 1.5.1 (#1, Jan 31 1999, 18:55:21)  [GCC 2.8.1] on irix6
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import hook
>>> def tst():print 'This is my hook function executing'
... 
>>> hook.actual_program()
>>> hook.hook=tst
>>> hook.actual_program()
This is my hook function executing
>>> 

Alex.




More information about the Python-list mailing list