[IronPython] __init__ ignored in favor of base class constructor? - blocker

Dan Eloff dan.eloff at gmail.com
Sun Nov 30 04:04:06 CET 2008


In the 2.1 branch of 43741, it seems there is trouble subclassing a
CLR class that has protected constructors.

# Silverlight Toolkit
import clr
clr.AddReferenceToFile('Microsoft.Windows.Controls.Theming.dll')
from Microsoft.Windows.Controls.Theming import Theme

class MyTheme(Theme):
    def __init__(self):
        raise ValueError

MyTheme()

TypeError: MyTheme() takes at least 2 arguments (1 given)

In fact you can try MyTheme(1,2,3) and get the same error. You can
also not define an __init__ on MyTheme and get the same error.

This would lead me to suspect it's trying the whole time to call the
protected 2 argument constructor, and is ignoring the Python __init__
method. This is a blocker as I've not found any way around it that
will work in silverlight.

By the way, should I should I be using the 2.0 branch rather? I expect
2.1 will be released long before I make my first release, so I thought
that's probably the way to go.

Thanks,
-Dan



More information about the Ironpython-users mailing list