Interesting problem - can it be done
Alex Martelli
aleax at aleax.it
Thu Aug 9 05:31:44 EDT 2001
"Erik Max Francis" <max at alcyone.com> wrote in message
news:3B722A4C.F8D9005C at alcyone.com...
...
> methods = ['method1', 'method2', 'method3']
> for method in methods:
> value = apply(getattr(testobj, method), ())
Good, but there's no reason not to spell the last line:
value = getattr(testobj,method)()
Entities should not be multiplied without necessity,
and the apply here is really doing nothing.
Alex
More information about the Python-list
mailing list