Are multiple return values really harmful? (Re: determining the number of output arguments)

Dave Brueck dave at pythonapocrypha.com
Wed Nov 17 22:54:00 CET 2004


Donn Cave wrote:
> In article <mailman.6491.1100708505.5135.python-list at python.org>,
>  Dave Brueck <dave at pythonapocrypha.com> wrote:
> 
>>Greg Ewing wrote:
>>
>>>Jeremy Bowers wrote:
>>>
>>>
>>>>Generally, returning a tuple is either a sign that your return value
>>>>should be wrapped up in a class, or the function is doing too much.
>>>
>>>
>>>While I suspect you may be largely right, I
>>>find myself wondering why this should be so. 
>>
>>*Is* it largely right? I don't think so. As you said, there doesn't seem to be 
>>anything "wrong" with passing multiple pieces of data _into_ a function, so why 
>>should we assume that complex data passing should be so one way?
> 
> 
> What's up with keyword arguments, then?  I don't think you can argue
> that on one hand keyword arguments are a valuable feature, but plain
> by-order tuples are a totally satisfactory interface on the other hand.

I don't think anybody is putting forth the opinion that by-order tuples are 
totally satisfactory. I just disagree that returning a tuple is generally a sign 
of something wrong with your function.

-Dave



More information about the Python-list mailing list