Diez B. Roggisch wrote:

> If you have more args, do this:
> 
> def test(self, *args):
>     return getattr(self, args[0])(*args[1:])
> 

This would be cleaner written as:

def test(self, method, *args):
    return getattr(self, method)(*args)

and for complete generality:

def test(self, method, *args, **kw):
    return getattr(self, method)(*args, **kw)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to