En Sun, 25 Mar 2007 17:22:36 -0300, 7stud <[EMAIL PROTECTED]> escribió:
> On Mar 25, 3:00 am, [EMAIL PROTECTED] wrote: >> On Mar 25, 9:13 am, "7stud" <[EMAIL PROTECTED]> wrote: >> >> > Is there some other way to retrieve a user-defined function object >> > from a class other than using the class name or an instance? >> >> What Steven B. already said, MyClass.__dict__['someFunc'], is a >> different way than MyClass.someFunc that produces different results. > > methObj = Test.__dict__["greet"] > print methObj.im_self > > Traceback (most recent call last): > File "test1.py", line 7, in ? > print methObj.im_self > AttributeError: 'function' object has no attribute 'im_self' Because this way, you get a function, not a method. I'd say "read something about descriptors" but... Nicolas Bourbaki [a collective of french mathematicians writing under that alias] said on a book about set theory: Any school boy can understand all of this with a minimum of effort, but for truly understanding what we are talking about, around four years of prior training on mathematics may be required. (I can't find the exact citation). I suggest first learn to use Python and then try to understand how it does what it does, along the way, and looking for answers when you have a question. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list