[Tutor] getattr()

János Juhász janos.juhasz at VELUX.com
Wed Jul 26 13:40:02 CEST 2006


Dear All,

I want to use getattr() to collect a list with all the functions on my 
simple script those has got some functionname like 'On....'.

#This should be the complete file
def OnMenuFindMe():
    print 'You found me'

f = getattr(What_Should_It_Be???, 'OnMenuFindMe')

f()
#Till here

It can use getattr() to get an object of a class or module, but not in 
this much simpler situation.



Yours sincerely, 
______________________________
János Juhász 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060726/b29c9a53/attachment.html 


More information about the Tutor mailing list