Christian Heimes <[EMAIL PROTECTED]> writes: > Stef Mientki wrote: >> hello, >> >> if I pass a class method to a function, >> is it possible to determine the class instance in that function ? >> >> class test ( object ) : >> def My_Method ( self ) : >> return 22 >> >> def do_something ( parameter ) : >> # here I want to determine My_Instance >> >> My_Instance = test () >> do something ( My_Instance.My_Method ) > > >> >>> class Example(object): > ... def method(self): > ... pass > ... >>>> example = Example() >>>> example.method.im_self > <__main__.Example object at 0x7fc3cdb5b650> >>>> example.method.im_class > <class '__main__.Example'> >>>> example.method.im_func > <function method at 0x7fc3cdb566e0>
.im_self will become example.method.__self__ and in python 3. But I can't see the equivalen of .im_class? -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list