Stuck on inheritance

zsolt zsolt-public1192 at
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

class call_me(object):
    def __init__(self, func, *args, **kw):
        self.func = func
        self.args = args = kw
    def __call__(self):
        print "Execing..."
        return self.func(*self.args, **
class function(call_me):
    def __init__(self, func, name='', info = []): # description,
authour, etc
        call_me.__init__(self, func, name, info) = name = 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 mailing list