Jim:
  Greg's answer is correct for you. Use it. It made me think of the
following question which you may safely ignore.
VC

Dear Gurus:

  This thread made me wonder.  (It happens occasionally.) The IronPython
team chose a different work-around for system calls: they have a class which
can be used to handle ByRef arguments.  The result is less Pythonic and less
elegant, but looks more like the calls made using other languages. Consider
the following code lifted from adodbapi. The Execute() method is the place
where the COM call actually executes the SQL statement which has been loaded
into self.cmd:

<code>
            if onIronPython:
                ra = clr.Reference[int]()      # prepare to get a ByRef
return parameter
                recordset = self.cmd.Execute(ra)
                count = ra.Value         # obtain the return value
            else: #pywin32
                recordset, count = self.cmd.Execute()       # the return
parameter is passed in a tuple
</code>

For the sake of compatibility, would it be worth the trouble to support the
option of using a return parameter helper class?

i.e. if an optional parameter is present, if it is a .Reference class, then
use it to return the value, else return an exception hinting that it must BE
a reference class,  else return the value as part of a tuple.  The exception
text should lead future programmers toward a correct solution.

Bad idea, or Good idea?
--
Vernon

On Thu, Dec 2, 2010 at 11:07 AM, Greg Antal <greg.an...@ata-e.com> wrote:

>  Jim:
>
> The thing about the Femap API is that its class methods use tons of ByRef
> arguments to return data to the caller. This is not something Python really
> supports. PythonCOM gets around it by turning the output arguments in to
> return values, but I find that only works if I enforce early binding.
>
<snip>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to