Python as an Object Oriented Programming Language

Roy Smith roy at panix.com
Wed Dec 18 08:43:39 EST 2002


"Andrew Thompson" <andrew.thompson at ashecastle.com> wrote:
> Hey! What's wrong with GOTO ?  Used in a controlled way, it can 
> Simplify code, and I am in favour of that.  Python's BREAK statements
> Are effectively gotos which get one out of a control-structure, without
> having to code up all sorts of weird stuff.

By that kind of logic, *all* flow control statements can be thought of 
as combinations of ifs and gotos.

The difference between goto and break is that break is very limited in 
where you can go to, namely the first statement after the immediately 
enclosing block (I hope I said that in a way that satifies language 
laywers).  So, if you're looking at a piece of code and think to 
yourself, "how could I get here?", the scope of places to look is 
limited to the immediately preceeding statement block.  If you're 
looking at a statement label in a language that has gotos and ask 
yourself the same question, the scope of places you have to look is now 
the entire function (compilation unit?)



More information about the Python-list mailing list