KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I frequently do this sort of thing: class Person(object): def greet(self): print "Hello" class Waiter(Person): def greet(self): Person.greet(self) print "Would you like fries with that?" The line Person.greet(self) doesn't seem right. If I ever change what class Waiter inherits from I'm going to have to track down every one of these and replace them all. What is the correct way to do this is modern Python? Both 2.x and 3.x, I understand there were changes in this area in 3. If it matters any I generally stick to single inheritance, but if extra stuff is required to accommodate multiple inheritance correctly it would be good to know about that.
Tags (comma-separated)
Save Edits
Cancel