[IronPython] Re: 'out' parameters

Nick Jacobson nicksjacobson at hotmail.com
Wed May 11 23:43:04 CEST 2005


I appreciate you giving this some thought.  I can't think of an elegant 
solution either..

I found a method called TestCooperativeLevel that doesn't use an 'out' 
parameter to return the device's status.  Instead, it throws a different 
Exception based on the device's status.  Therefore it makes a good 

Also, I filed a bug report for this problem (bug #104).

Thanks again for your help.


Martin wrote:

<< Nick,

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
Martin >>

Express yourself instantly with MSN Messenger! Download today - it's FREE! 

More information about the Ironpython-users mailing list