|class Parent(object): | def __init__(self, name="I am a parent"): | self.name = name | |class Child(Parent): | def __init__(self, number): | super(Parent, self).__init__("I am a child") | self.number = number | |# I would like it to produce the following: |>> c = Child(23) |>> c.name |"I am a child"
I don't know the direct answer but the more common way of doing that in Python is not to use super() but just call the inherited constructor directly: Parent.__init__(self,'I am a child') SO if you just want to fix the itch use that, if you want to understand super() then that won't help and its over to someone else! :-) HTH, Alan G _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor