Arguments of function as out
aleax at aleax.it
Thu Sep 4 15:18:42 CEST 2003
Birgit Rahm wrote:
> Hallo Alex,
> I hope this posting is near to the netiquette.
>> Birgit, you do not seem to have *READ* the answer to which you are
> I dont understood this in the you described it.
>> >> * If there is more than one result value, all of them are packed into
>> >> a
>> >> tuple, and this tuple is returned.
> I've read this, but I thought that this tuple is returned with the
> return statement. I am new to python and I never seen such
> a constract:
The code that implements this CORBA spec (if it is Python code -- it
is quite possible to implement CORBA brokers in Python, and it has
been done) will quite likely use the return statement for this, yes,
of course. But when you CALL the code, you don't need to worry
whether it uses a return statement or some other black magic: you
can code your call AS IF the code you called was Python code that
uses a return statement for the tuple, e.g.
return 23, 42, 69
therefore you call it as, e.g.:
a, b, c = X()
would set a to 23, b to 42, c to 69. (You need to know how many
items are in the tuple X returns, to use this kind of assigment
which is called "unpacking assignment", because you need to list
exactly that number of targets on the left of the = sign).
> I have had only the IDL and the py File from the IDL,
> were stand take *args and return the return value.
> In none of my python books such a construct is described. I'm sorry.
> Thanks for helping me,
No problem, and you're welcome. I do understand that Python books
don't say much about Corba (I didn't myself in the Nutshell, and
there is just one very simple example in the Cookbook which does
not cover the cases of out and inout parameters). But if the books
don't cover *args and/or return-value packing and unpacking, then
you might want to get better books;-)
More information about the Python-list