Funny how any programmer will always tell you that goto's are evil. Ofcourse they are. But every programmer also effectively uses them all the time. The return, break and continue statements that exist in most programming languages are goto's in disguise. And good ones too. I guess they were invented when language inventors realized these represent safe usage patterns of the goto statement. Not using them will generally result in indentation bloat, because they are naturally suited to preconditions (for programming languages that don't support preconditions in the language itself, which happens to be most of them). Hence, not using them makes your code harder to read.
Ofcourse I'm right, because the zen of python clearly states "flat is better than nested" :)
If you really push it then any iteration construct itself (without break or continue) is also a goto (or even multiple goto's) in disguise, but ok, no point in going there.
Friday, May 11, 2007
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment