[IronPython] Multiple-inheritance with builtin types

Sanghyeon Seo sanxiyn at gmail.com
Thu Apr 20 09:04:07 CEST 2006

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

More information about the Ironpython-users mailing list