late bindings ???

Laura Creighton lac at strakt.com
Mon Dec 2 10:18:03 EST 2002


Do you really need to store a list of function names, or would method
names work just as well for you?  If method names would, you can use 
getattr.  getattr(obj, 'xxx') is equivalent to obj.xxx.

        try:
            handler = getattr(obj, string)
        except AttributeError:
            pass
        else:
            handler(*args)

Laura Creighton




More information about the Python-list mailing list