[IronPython] not support Mixin
jimhug at exchange.microsoft.com
Fri May 27 19:04:15 CEST 2005
Chu Kevin wrote:
> >>>class RoseLoveSomebodyElse:
> def sayGoodBye(self):
> print "Let's say goodbye tonight."
> a error occur
> IronPython.Objects.PythonAttributeError: 'lover' object has no
> attribute 'sayGoodBye'
Thanks for the entertaining and yet still self-contained repro. It's a
lot more fun than a lot of foo's and bar's.
Unsurprisingly, you've found a bug. The bug is that __bases__ on
old-style Python classes isn't settable. This is a simple bug to fix
and we'll fix it for 0.7.6. The same bug is present for __dict__ on
old-style classes - but not anymore on old-style instances (as of
0.7.5). There are a few similar attributes and we'll try to get most if
not all of them in this space this time around.
In IronPython's implementation, there has been more focus on new-style
classes as they are presumably the future direction of Python's classes
and they also are the route to the best integration with CLS types. If
you change your example to make both lover and RoseLoveSomebodyElse
extend object - and thus make them Python new-style classes - your
example will run under IronPython. (Note: You will then discover that
this changed example won't run in CPython with a complaint about no
consistent MRO between object and RoseLoveSomebodyElse. So, we still
have more work to do.)
Thanks for the interesting bug - Jim
More information about the Ironpython-users