pyjs / pyjs

Pyjs canonical sources. Start here!
http://pyjs.org/
Apache License 2.0
1.14k stars 214 forks source link

Inheritence not according to mro with multiple base classes #159

Open pyjsorg opened 12 years ago

pyjsorg commented 12 years ago

class Foo(object): pass class Bar(object): def str(self): return 'bar' class FooBar(Foo, Bar): pass class BarFoo(Bar, Foo): pass

foo = Foo() print = str(foo) bar = Bar() print str(bar) foobar = FooBar() print str(foobar) barfoo = BarFoo() print str(barfoo)

Original issue: http://code.google.com/p/pyjamas/issues/detail?id=560 (March 05, 2011 11:01:46)

pyjsorg commented 12 years ago

From cornelis...@gmail.com on March 05, 2011 11:11:30: Created a libtest for this.

When copying the methods from super classes in the mro, in the current implementation the Foo will have str from object and when FooBar is created, the str from Bar is not copied since FooBar already got the str from Foo (which is from the lowest in hierarchy).