>> > I am trying to wrap my head around the super constructor.

Is it possible to embed a super constructor into an if / elif
statement within the child class?

if message == "string A": return X
elif: return Y

How should I modify my code below?
(I couldn't solve that by myself)

class A:
    def __init__(self, message):
        self.message = message
        print(message)

class B(A):
    def __init__(self, message):
        print("This is the message from your parent class A:")
        super(B, self).__init__(message)

B("BlaBla")
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to