Confused about bound functions

Theodore D. Sternberg strnbrg at
Sat Aug 18 18:49:02 CEST 2001

Why do I need to pass in a self argument, in the
last line of the following program?

class C:

c = C()
cmd = 'def foo(self): print "I am foo"'
exec cmd in c.__dict__

I'd like to be able to say simply "".
How can I arrange for that?

Theodore Sternberg
Fremont, Cal. USA

More information about the Python-list mailing list