[Tutor] Multiple exits in a function...
Alan Gauld
alan.gauld at blueyonder.co.uk
Fri Oct 24 17:19:10 EDT 2003
> I really don't see what's wrong with multiple returns,
> especially in a simple function like this.
YOu have actually just hit on a very important point.
Where the functions are short and only have a few levels
of nesting - as is usually the case in languages like
Python - the whole issue of comprehension and levels
of reading are much less important.
In more traditional 3rd generation languages like C
or Pascal it was quite common for *functions* to
be 50-100 lines long with up to 7 or more levels of
indentation/nesting. In that type of environment
the ability to stop reading after more than 2 levels
of indent and still make sense of the code was
very important.
When the whole *program* is only 100 lines then the
issue is much less serious. But then again the whole
need for structure is much less serious!
Alan G.
More information about the Tutor
mailing list