call method by name?

Mark McEahern marklists at mceahern.com
Thu Jan 24 18:31:04 EST 2002


andreyw:
> How to say this in Python?
> 
> method_name = 'method1'
> a. at method_name()

  method = getattr(instanceName, methodName, None)
  method()

Cheers,

// mark




More information about the Python-list mailing list