[IronPython] Operator resolution with implicit conversion
Jeffrey Sax
jeffrey at extremeoptimization.com
Sun Jul 26 22:08:29 CEST 2009
Given the following C# code:
public class A {
public static A operator+(A a1, A a2) { return null; }
public static implicit operator A(int n) { return null; }
}
public class B : A {}
In C#, I can then write:
B b = new B();
A c = b + 1;
However, in IronPython I get:
>>> b = B()
>>> c = b + 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'B' and 'int'
Is there a general policy regarding this kind of .NET interop?
Thanks,
Jeffrey
More information about the Ironpython-users
mailing list