Stuck on inheritance
zsolt-public1192 at mailblocks.com
Wed Nov 5 05:45:45 CET 2003
I too am very new to the concept of classes and inheritance in python.
I do not have a grasp on how to use "super",nor do I think it is well
documented. The below code alterations shows how I learned to
I may not have a complete grasp of what you were trying to do because
I had to add .func to a_call_me where you instanciated function.
Also,I added args to print_message, to get the the args you are adding
passed through. Anyway, I hope I'm not too off the mark.
def print_message(*args, **kw):
print "I am a message"
print args, kw
def __init__(self, func, *args, **kw):
self.func = func
self.args = args
self.kw = kw
return self.func(*self.args, **self.kw)
def __init__(self, func, name='', info = ): # description,
call_me.__init__(self, func, name, info)
self.name = name
self.info = info
a_call_me = call_me(print_message)
func = function(a_call_me.func, 'fred', )
# also tried func = function(call_me(print_message), 'fred', )
More information about the Python-list