Out parameters compatible with IronPython

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Out parameters compatible with IronPython

Urs Fleisch-2
The way out and ref parameters are handled is not compatible with
IronPython. In IronPython, out parameters do not have to be provided,
in pythonnet, you always have to pass something (but it is not really
used). The resulting out parameters are returned as return values in
both IronPython and pythonnet, but a void result is always omitted in
IronPython whereas it is only omitted in pythonnet if there is only a
single out parameter.

Example:

To call method "public static void TwoOut(int i, out string sOut, out
int iOut)" you have to use "TwoOut(iIn, sOut, iOut)" in pythonnet with
sOut a string and iOut an int, and you will receive a (void, string,
int) tuple as the return value; in IronPython, you can call
"TwoOut(iIn)" and you get a (string, int) tuple as the result.

I have added a patch at
https://sourceforge.net/tracker/?func=detail&aid=3117417&group_id=162464&atid=823893,
which makes the IronPython behavior available in pythonnet while still
keeping compatibility with the existing behavior.

-Urs
_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet