From: Louis-Philippe Date: 2008-12-13T05:21:57+09:00 Subject: Re: parallel method return value ------=_Part_16229_16188157.1229113742236 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks Matthew, "No, because what was provided before wasn't wrong." Yeah... I believe you, but would really like it to be else! L-P 2008/12/12 Matthew Moss > > On Dec 12, 2008, at 1:25 PM, Louis-Philippe wrote: > > Hi guys, >> >> Thanks for your answer,I get your points... >> but in this case, what I really want to do is have the method return the >> right number of values for the corresponding quantity of lvalues presented >> to it, to make it context sensitive you know, so I can have, for example, >> a >> boolean first return value when it is called with one lvalue and a boolean >> plus a string when called with two rvalue. The assignment operator does >> it, >> so I would have expected the same behaviour to also work with a method. >> > > But as was pointed out, methods _always_ return one value, even if it > appears to return multiple values. They are lumped together into one array. > > right now my options are: >> >> a, = a_method >> >> or >> >> a = a_method[0] >> >> both ways still involve to ask for only one to return. What I am looking >> for, if it exist, is for the method to automatically detect context and >> act >> from it like the = operator. I find how the assignment operator >> implements >> this is very elegant, and am crave it for methods!! >> > > There isn't any way for the method call to recognize the context in which > it is being called. You'd have to pass an argument, such as the "number of > return values" to return. > > a, b = a_method(2) > a = a_method(1) > > Which seems pointless, when you can instead do what you've already > identified as the proper technique: > > a, = a_method > a, b = a_method > a, b, c = a_method > # etc. > > Anybody can prove this wrong? (please!!) >> > > No, because what was provided before wasn't wrong. > > > ------=_Part_16229_16188157.1229113742236--