return command in a function.

Markus Schaber markus at
Thu Sep 27 15:31:02 CEST 2001


Brian Lee <senux at> schrub:

> 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?

Well - if you don't like "goto", you have to use the intercal 
programming language. They define a "come from" instruction instead. :-)

Seriously, I personally think return, break and continue just help to 
avoid series of nested if statements, and - carefully used - can help 
to make the code faster and more readable.


"The strength of the Constitution lies entirely in the determination of 
each citizen to defend it. Only if every single citizen feels duty 
bound to do his share in this defense are the constitutional rights 
secure." -- Albert Einstein

More information about the Python-list mailing list