return command in a function.

Ignacio Vazquez-Abrams ignacio at openservices.net
Wed Sep 26 22:10:48 EDT 2001


On Thu, 27 Sep 2001, Brian Lee wrote:

> Hi all! I'm newbie at programming and especially Python langauge.
>
> What do you think when someone put return, break or continue command
> in half of a function. I think that commands are like ``goto'' It is very
> confused for me to understand big code because such commands
> jump un-excepted line.
>
> What do you think about this and how can get be avoid of using
> such commands? Any advice?

Heh. That's actually quite humorous to hear. It's one thing to not like gotos,
but to actually give up the benefits of structured programming by eliminating
break and continue and only allowing return at the end of a function borders
on insanity.

Yes, it is possible to write complex code without them, but only if you're
prepared to write hundred-line if blocks and you honestly believe that doing
that would make clearer code than using break, continue, or a premature
return.

Which it won't, I promise you.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list