[Tutor] multiple function returns

Sydney Shall s.shall at virginmedia.com
Fri Jun 28 18:21:44 CEST 2013


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

> return False


>>
>> I'll leave it to you to work out why that works.  It's very handy!
>>
> Hey, it saves typing an "else" and as you know, I'm the Lazy Typist.
> My program to make dicts, lists, etc from a single string, using no
> special characters, has saved me so much little-finger typing already
> I'd never part with it, flawed as it is. It's good-enough ;')
>
> Jim
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


-- 
Sydney Shall


More information about the Tutor mailing list