Referencing objects own functions

pip jackson.pip at gmail.com
Tue Oct 19 11:45:42 EDT 2004


Hi all,

Pretend I have the following:

class foo:
  commands = [
    'name': 'help',
    'desc': 'Print help',
  ]

  def print_help(self):
    print "Help is on the way!"

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.

Thanks,

Pip



More information about the Python-list mailing list