Referencing objects own functions

pip jackson.pip at
Wed Oct 20 10:29:48 CEST 2004


aleaxit at (Alex Martelli) wrote in message news:<1glxgoc.ytb70mbla970N%aleaxit at>...
> pip <jackson.pip at> wrote:
> > [...]
> > I would like to add another entry to the commands dict. called 'func'
> > or something which contains a reference to a function in the foo
> > class. What would the entry look like if atall possible?
> > 
> > I would rather not use eval if possible.
> [...]
> getattr(f, f.commands['func'])()

Just what I was looking for.

Thanks all for your help,


More information about the Python-list mailing list