while (a=b()) ...

Dan Schmidt dfan at harmonixmusic.com
Fri Apr 30 10:18:14 EDT 1999


Nathan Clegg <nathan at islanddata.com> writes:

| I have some deep-rooted "hates" in programming and don't even know
| where some of them came from.  One of them is "while 1" loops.  They
| seem somehow at the same level as goto statements and should be
| used, in my mind, about as rarely.
| 
| The ideal, of course, would be:
| 
| while (c = curs.fetchone()): ...
| 
| That is my only complaint about python, that statements cannot be
| expressions.

Everyone who is at all interested in loops should read Knuth's article
"Structured programming with go to statements", found in his book
"Literate Programming".  Don't be fooled by the title or the fact that
it was written in 1974.  It's a comprehensive (70 pages) overview of
looping constructs, including convincing proposals for some new ones.
Certainly all language designers owe it to themselves to read it.

-- 
                 Dan Schmidt -> dfan at harmonixmusic.com, dfan at alum.mit.edu
Honest Bob & the                http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
          Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/




More information about the Python-list mailing list