Hi everyone,
Is there a way to call a superclass method after I've overridden it in
a subclass?

Specifically, what I'm trying to is something like the following:

class Parent(object):
    def add_name(self):
        self.name = result_of_GENERIC_SQLcall()

class Child(Parent):
    def __init__(self):
        super(Child, self).__init__()

    def add_name(self):
        name = result_of_SPECIALIZED_SQLcall_for_child()
        try:
            name + ''
            self.name = name
        except TypeError:
            #default to the superclass's add_name method
            Base.add_name()

My key point of confusion is in the except clause: I'm not sure of the
syntax for calling the original superclass method (or if it's even
possible). Can anyone point me in the right direction?

Regards,
Serdar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to