Probably a stupid question... name-->method lookup

Bengt Richter bokr at accessone.com
Wed Aug 22 20:09:38 EDT 2001


On Wed, 22 Aug 2001 14:21:34 -0700, "Emile van Sebille" <emile at fenx.com> wrote:

>Does this help get you started?
>
>
>>>> class A:
>...     def a(self):
>...             print 'A.a()'
>...
>>>> class B(A):
>...     pass
>...
>>>> eval('B.%s' % 'a')
><unbound method A.a>
>
What was that eval weirdness for? ;-)
 >>> class A:
 ...     def a(self):
 ...             print 'A.a()'
 ...
 >>> class B(A):
 ...     pass
 ...
 >>> B.a
 <unbound method A.a>

or am I missing something?



More information about the Python-list mailing list