return command in a function.

Ignacio Vazquez-Abrams ignacio at openservices.net
Thu Oct 4 00:04:48 EDT 2001


On 4 Oct 2001, Quinn Dunkan wrote:

> On Wed, 26 Sep 2001 22:10:48 -0400 (EDT), Ignacio Vazquez-Abrams
> <ignacio at openservices.net> wrote:
> >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.
>
> I guess you've never written Pascal.  Neither have I, but I have written
> Eiffel (though I never had a problem with lack of loop control or
> return---possibly your hundred line blocks illustrate a different problem)

Actually Pascal was my fourth language (after BASIC, machine code, and
assembly). I remember those hundred-line blocks quite vividly; well, maybe
only 20-30 lines, but you know what I mean(t).

> See Kernighan's classic "Why Pascal is Not My Favorite Programming Language",
> especially the "death of a thousand cuts" section:
>
> http://www.lysator.liu.se/c/bwk-on-pascal.html

Yeah, that sounds about right...

> I find it humorous that you describe elimination of break and continue as
> "giving up on the benefits of structured programming" because one-in one-out,
> no return, no loop control, etc. were the basic *tenets* of structured
> programming when everyone got so gung-ho about it in the 70s or 80s or
> whenever.  I imagine that back in the goto-considered-harmful day all the
> structured programming quiche-eaters sneered at C for being such a backsliding
> recidivist.

Yeah, well... it's the 21st century now, right? (Yeah, that's it!) ;)

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





More information about the Python-list mailing list