[Tutor] Testing print

boB Stepp robertvstepp at gmail.com
Sat Oct 1 21:46:46 EDT 2016


On Sat, Oct 1, 2016 at 7:19 PM, Alan Gauld via Tutor <tutor at python.org> wrote:
> On 01/10/16 23:08, boB Stepp wrote:
>> On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor <tutor at python.org> wrote:
>>
>>> ... Personally I don't like functions that
>>> sometimes return one and sometimes two results. I'd rather
>>> you returned a None first argument in the first case
>>> to make it consistent.
>>
>> Why don't you like doing this?  What are the pluses and minuses as you
>> see them?
>
>
> Because client code has to guess which return value is relevant

[snip]

> So I need to introduce code to determine whether I got
> an int or a tuple back and then separate code for each
> case. If I know that the result is always an int I can
> use the first case if I know its always a tuple I can
> use the second. But not knowing which is just plain
> messy.

So in which sorts of scenarios would you use argument unpacking?

-- 
boB


More information about the Tutor mailing list