[Tutor] multiple function returns

Alan Gauld alan.gauld at btinternet.com
Fri Jun 28 09:44:55 CEST 2013


On 28/06/13 05:18, Jim Mooney wrote:
> What's the Pythonic standard on multiple returns from a function?

There is no standard.
Multiple returns are quite common but they come with all the usual 
caveats for using them, they can introduce complexity and hard
to find bugs so use them sensibly.

Computer Science purists don't like them for good theoretical
reasons, but personally I find them one of the least offensive
of the "rule breakers" and forcing a single exit can often
involve ugly extra conditionals etc.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list