kobra (.NET for Python) Update
cgjunkaddr at attbi.com
Fri Jan 31 07:17:28 CET 2003
Well, after many headaches, I decided to get rid of the mapping between
Python tuples/lists to .NET arrays.
Partially due to the fact that Python lists and tuples are not strongly
typed, but more because .NET already has Collection types, and I wanted this
layer to be thin, I decided to get rid of this mapping.
So now, the impact:
You can no longer expect strongly typed arrays. In other words, .NET treats
String differently from Object containing "String" objects.
You can still pass arrays of arrays - they will all map to Object...
But to simply pass strongly typed arrays, you can just create an ArrayList
object, add objects and call "ToArray"
For an example see the docs:
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import kobralib
>>> coll1 = kobralib.createObject("mscorlib",
kobra - A Python Wrapper for .NET
Copyright (C) 2003 Chetan Gadgil (chetan at gadgil dot net)
All Rights Reserved
>>> asm = coll1.GetType().Assembly()
>>> t1 = asm.GetType("System.String")
>>> ma = coll1.ToArray(t1)
I know, this is a bit roundabout, but I will add utility methods to the
A newer version with a fix for a serious ClassCastException is also
More information about the Python-list