How can you prevent self from being passed to a function stored as a
member variable?
class Foo(object):
def __init__(self, callback):
self.func = callback
f =Foo(lambda x: x)
f.func(1) # TypeError, func expects 1 argument, recieved 2
I thought maybe you could do this:
class Foo(object):
def __init__(self, callback):
self.func = staticmethod(callback) # Error, staticmethod not
callable
Somebody (maybe everybody other than myself) here must know?
Thanks,
-Sandra