[IronPython] Re: Why won't these snippets run?

Ray Djajadinata rayfd_2000 at yahoo.com
Mon Sep 19 09:11:50 CEST 2005

Hi Martin!

Thanks! I think last time you mentioned that IP
already had generators--were you referring to 0.9.2 or
some other version in the future?

Also... regarding the Array, is there any workaround?
I tried this:

from System import Array, Convert, Int32
pyList = [9, 7, 8, 4, 6, 3, 6, 8, 4, 1]
toBeSorted = Array.CreateInstance(GetType(Int32),
for index, item in enumerate(pyList):
    toBeSorted.SetValue(item, index)

but I got this:

Traceback (most recent call last):
   at __main__.Initialize() in
C:\temp\workaround.py:line 5
System.InvalidCastException: Object cannot be stored
in an array of this type.


Yahoo! for Good 
Donate to the Hurricane Katrina relief effort. 

More information about the Ironpython-users mailing list