Steven Kah Hien Wong wrote: > class CommonBase: > x = 0 > > class ChildOne(CommonBase): > None > > class ChildTwo(CommonBase): > None > > class ChildOneAndTwo(ChildOne, ChildTwo): > def run(self): > ChildOne.x = 1 > print "one =", ChildOne.x > print "two =", ChildTwo.x > > ChildOneAndTwo().run() > > And the output was: > > $ python multi.py > one = 1 > two = 0 > > According to the documentation, I thought it should be: > > one = 1 > two = 1 Nope. In the code, you set a new attribute 'x' on the ChildOne class. Change the end of your code to ChildOneAndTwo().run() print "CommonBase.x", CommonBase.x print "ChildOne.x", ChildOne.x print "ChildTwo.x", ChildTwo.x Anthony
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4