[Python.NET] Fixes for interface inheritance and abstract properties.

Bruce Dodson bruce_dodson at hotmail.com
Thu Apr 1 10:37:17 EST 2004


Problem 1 can also be seen on ADODB.Connection.  It is not specific to COM, 
though:

Interface ICollection inherits from IEnumerable.  In C#, if I declare a 
variable as ICollection, I'll see GetEnumerator.  In Python, if I cast to 
ICollection, I do not see GetEnumerator.  I think this is because interface 
inheritence is a different animal than class inheritance.  It seems to be more 
contractual than structural.

I sent a workaround to Brian.  The fix is probably not the best way of doing 
it, and is probably not complete, but it does seem to help.

-

I noticed as well that properties on interfaces don't work, e.g. I have to call 
get_Count() rather than just accessing the Count property.

from CLR.System.Collections import Hashtable, ICollection
ht = Hashtable()
c = ICollection(ht)
print c.Count #fails

A fix for this is also sent to Brian.

Bruce






More information about the PythonDotNet mailing list