[Python.NET] How to use "out" or "ref" on method parameter list

Brian Lloyd brian at zope.com
Thu Mar 25 10:03:02 EST 2004

Hi Jill -

Python for .NET doesn't yet handle in, in/out, ref etc. parameters yet. This
is one
of the (surprisingly few) places where the Python model doesn't match well
.NET. In the future, I expect that Python will return a tuple of (result,
outparam, outparam...)
to handle out params, but its not there yet.

A quick workaround would be to implement a helper method that calls MyMethod
and returns the modified int as its result, then call that from Python. (If
you need
both the bool result and the int, you could return a struct, etc.)

Hope this helps!

Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716
Zope Corporation   http://www.zope.com

  -----Original Message-----
  From: pythondotnet-bounces at python.org
[mailto:pythondotnet-bounces at python.org]On Behalf Of Jill-Connie Lorentsen
  Sent: Thursday, March 25, 2004 7:26 AM
  To: pythondotnet at python.org
  Subject: [Python.NET] How to use "out" or "ref" on method parameter list

  I have a DotNet class with methods with the following signature:

  public bool MyMethod(out int myVariable)
    myVariable = 5;
    return true

  Does anybody know how I cancall them from Python via CLR?
  I've tried MyMethod(a), where a has been an empty list, a list with one
  element, an integer etc, but nomatter what i get an error saying
  no method matches given arguments

  Can anybody help?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20040325/2383f5a8/attachment.html

More information about the PythonDotNet mailing list