[IronPython] Re: 'out' parameters

Martin Maly martmaly at exchange.microsoft.com
Wed May 11 22:19:53 CEST 2005


This is a very tricky case. Jim and I just discussed it and while we
want to provide good solution to this case, it may take some time to
come up with the right way to solve the problem because on syntactic
level there is really no way to distinguish between the two methods.

If you need short-term workaround solution (and I am fully aware that
this is neither pretty nor it is very pythonic thing to do), you can
write snippet in C# that will help you distinguish the methods.
Something like:

using Microsoft.DirectX.Direct3D;

static class Call {
    static bool CheckCoopLevelOut(Device _this, out int result) {
        return _this.CheckCooperativeLevel(out result);
    static bool CheckCoopLevel(Device _this) {
        return _this.CheckCooperativeLevel();

And call from Python:

boolReturn, intResult = Call.CheckCoopLevelOut(device)
boolReturn = Call.CheckCoopLevel(device)

As I said, it is not pretty, but if it is blocking you from making
progress (and finding other great bugs like this one) it may help. Do
you want to file this as a bug on GotDotNet?

Thanks and I hope this helps

> Nick Jacobson Wrote:
> Thanks for the reply, and it makes sense :)
> Unfortunately, a call to CheckCooperativeLevel() returns True, not a
> tuple.
> This is probably because there are two overloaded
> methods in the Device class in the Microsoft.DirectX.Direct3D
> They are:
> public bool CheckCooperativeLevel();
> public bool CheckCooperativeLevel(out int result);
> IronPython has no way of knowing I want the second and not the first.
> --Nick

More information about the Ironpython-users mailing list