On 4 Sep 2006 09:39:32 -0700, Sandra-24 <[EMAIL PROTECTED]> wrote: >How can you prevent self from being passed to a function stored as a >member variable?
This doesn't happen: >>> class x: ... def __init__(self): ... self.x = lambda: None ... >>> x().x() >>> class y(object): ... def __init__(self): ... self.y = lambda: None ... >>> y().y() >>> Perhaps you confused this case with the case of a function which is a class attribute? >>> z().z() Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: <lambda>() takes no arguments (1 given) >>> In which case, staticmethod() is actually the solution you want: >>> class w(object): ... w = staticmethod(lambda: None) ... >>> w().w() >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list