On Fri, Mar 16, 2012 at 4:24 AM, Doug Blank <[email protected]> wrote:
> This is looking more and more like a bug. I see from
> http://stackoverflow.com/questions/799987/how-to-pass-a-lambda-expression-to-a-c-sharp-constructor-from-an-ironpython-scri
>
> that it works for constructors (and have verified that it does), but I
> can't figure out any way to make it work with a static method. Why the
> difference?
Well, it could just be a bug :), and I haven't investigated it at all,
so this is speculation. However, in the first method (the params []
one) the callables are being passed directly, while in the second
they're being converted as part of a list -> List<> conversion.
IronPython's conversion code is, um, interesting -- Dino might
understand it all, but I don't know if anyone else does -- so it's
possible two different sets of conversions are being chosen. Now, this
*shouldn't* be the case, but it's my hypothesis.
>
> If it is a bug, is there a workaround? How can I pass any Python
> callable to a C# static method?
Try the conversion on the Python side, manually:
f = System.Func[System.Object](test1)
Myro.getFunc1(f)
Myro.getFunc2([f])
- Jeff
_______________________________________________
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users