[IronPython] Questions for FAQ or User Guide

Martin Maly martmaly at exchange.microsoft.com
Wed Apr 20 01:36:37 CEST 2005

>>> John A. Tenney Wrote:
>>> 1. I'd like to pass an array of 6 doubles to a method, but get an
error message.
>>> For example, the "myMethod" call below fails when it requires a
double array.
>>> array=[1, 2, 3.5, 4]
>>> myObject.myMethod(array)

If you create the array using the syntax above, you end up with object
of type list.
To create .Net array, you can do the following:

>>> import System
>>> array = System.Array.CreateInstance(System.Double, 5)
>>> array[0]=1.3
>>> array
System.Double[](1.3, 0, 0, 0, 0)

And call:


>>> 2. I'd like to invoke an overloaded operator, or it's backing op_xxx
>>> For example, both of these fail:
>>> myComplex = myComplex1 + myComplex2
>>> myComplex = Complex.op_Addition(myComplex1, myComplex2) 

This will be enabled in the 0.7.3 release which is coming out soon.
In 0.7.2 there is no way to access the user defined operators.


More information about the Ironpython-users mailing list