catching signals in an object
no-spam at no-spam-no-spam.invalid
Mon Jan 15 18:32:52 CET 2007
> I need to catch a signal "SIGUSR1" in an object ... and I need the signal
> def that traps is to access the object context ... is that possible ?
> (*nix and windows)
> class test:
> def __init__(self):
> def Set_Signal(self):
> import signal
> signal.signal(..., Func)
> def Func(.....):
> #I need to get access to self
> or can signal.signal take a method as param ?
Just do it! Python is a functional language.
You have access to self (search for the term "closure") and
self.method is bound - thus a 'function'
objects are nothing special in Python.
More information about the Python-list