Referencing objects own functions

pip jackson.pip at gmail.com
Wed Oct 20 04:29:48 EDT 2004


Alex,

aleaxit at yahoo.com (Alex Martelli) wrote in message news:<1glxgoc.ytb70mbla970N%aleaxit at yahoo.com>...
> pip <jackson.pip at gmail.com> 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,

Pip



More information about the Python-list mailing list