Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Can I inherit member variables?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="bearophileHUGS, post: 1946279"] MonkeeSage: If you have multiple inheritance do you need the old style init anyway? class Animal1(object): def __init__(self, weight, colour): self.weight = weight self.colour = colour class Animal2(object): def __init__(self, name): self.name = name class Bird(Animal1, Animal2): def __init__(self, weight, color, wingspan, name): super(Bird, self).__init__(weight, color) # Animal1 Animal2.__init__(self, name) self.wingspan = wingspan print self.weight, self.colour, self.wingspan, self.name al = Bird(12, "White", 2, "Albatross") Bye, bearophile [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Can I inherit member variables?
Top