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

Joseph Andrew Knapka jknapka at earthlink.net
Wed Aug 22 17:30:51 EDT 2001


Emile van Sebille 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>


Yes, this is quite nice, thanks :-)

-- Joe

-- 
# Joe Knapka
# "You know how many remote castles there are along the
#  gorges? You can't MOVE for remote castles!" - Lu Tze re. Uberwald
# Linux MM docs:
http://home.earthlink.net/~jknapka/linux-mm/vmoutline.html



More information about the Python-list mailing list