[Tutor] multiple function returns

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Jun 28 18:55:02 CEST 2013


On 28/06/2013 17:21, Sydney Shall wrote:
> On 28/06/2013 18:06, Jim Mooney wrote:
>>>>>> def foo(x):
>>> ...     if x:
>>> ...         return True
>>> ...     return False
> Does one need the last line?
>

Yes otherwise the default of None is returned, although in this 
situation it might not make much difference.  Then again explicit is 
better than implicit :)

-- 
"Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green." Snooker 
commentator 'Whispering' Ted Lowe.

Mark Lawrence



More information about the Tutor mailing list