Stuck on inheritance

Matthew matthew at
Tue Nov 4 22:44:50 CET 2003


I'm trying to learn python and actually do something usefule with it at the
same time. I'm unclear how you correctly pass arguments to a superclass when
ining the subclass. Below is a short code fragment. What's wrong? Thanks
alot. matthew.

def print_message():
    print "I am a message"

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, name='', info = []): # description, authour, etc
        super(call_me, self).__init__() = name = info

a_call_me = call_me(print_message)
func = function(a_call_me, 'fred', [])
# also tried func = function(call_me(print_message), 'fred', [])

More information about the Python-list mailing list