[Python.NET] Problems with subclasses...

Brian Lloyd Brian.Lloyd at revolution.com
Fri May 26 16:49:54 CEST 2006

Hi Markus -
a limitation of Python for .NET is that overrides you write in Python are only visible to Python code. There is some possibility that in the future we could generate a .NET subclass whenever you subclass in Python and provide delegate implementations of overridden methods that would be visible to .NET, but that does not currently exist.


From: pythondotnet-bounces at python.org on behalf of Markus Schumacher
Sent: Fri 5/26/2006 10:28 AM
To: pythondotnet at python.org
Subject: [Python.NET] Problems with subclasses...

Hi list,

Sorry if this is posted twice, however I didn't see this message on the
list. Maybe the company mailserver hasn't delievered it :(

I got a problem here. I have the a class in .NET1.1 (Class A) with
the method public virtual void Do() for example.
Another .NET class (say Class B) has a collection of Class A and a
method DoAll() which iterates over all
Class A in B and calls the Do() Method.
So now comes the problem. In Python I have a class MyA derived from
.NET Class A and overrides the method Do().

Now I add some of my MyA class to the B class and execute DoAll() on
B. Surprisingly, only the Do() methods of A are called not the
PythonNet Do() in the MyA instances.

I would have expected that the MyA.Do() will be called. Is this a bug?
I'm using the RC2 of PythonNet for .NET1.1 and Python2.4.2.

Any ideas?


Python.NET mailing list - PythonDotNet at python.org

More information about the PythonDotNet mailing list