[IronPython] Multiple-inheritance with builtin types

Dino Viehland dinov at exchange.microsoft.com
Thu Apr 20 17:13:05 CEST 2006

Thanks for the report.  This is another issue we've already fixed for beta 6 - inheriting from a mix of new-style classes as well as old-style classes.

This was part of a large cleanup around __metaclass__ defined at the module scope, support for __metaclass__ being a function, support for __mro__ on new-style classes, and some random other fixes for more CPython compatibility.  So you should be seeing this fix real soon now.

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Thursday, April 20, 2006 12:04 AM
To: Discussion of IronPython
Subject: [IronPython] Multiple-inheritance with builtin types

Example code:

class CompatMixin:
    def __getattr__(self, attr):
        if attr == 'string':
            return self
            raise AttributeError, attr

class CompatString(str, CompatMixin):

s = CompatString('abc')
print s
print s.string

The intent is to provide backward-compatibility with previous API, so
that using the string as s and s.string both work. Above code was
modelled after similar code in BeautifulSoup, a popular Python

IronPython says:
NotImplementedError: CompatString: unsupported base type for new-style
class: IronPython.Runtime.ExtensibleString

Seo Sanghyeon
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list