61 lines
1.3 KiB
Plaintext
61 lines
1.3 KiB
Plaintext
From: Friedrich.Dominicus at inka.de (Friedrich Dominicus)
|
|
Date: Fri, 30 Apr 1999 07:42:13 +0200
|
|
Subject: while (a=b()) ...
|
|
References: <XFMail.990429164839.nathan@islanddata.com>
|
|
Message-ID: <372942B5.729506A6@inka.de>
|
|
Content-Length: 1063
|
|
X-UID: 352
|
|
|
|
Nathan Clegg wrote:
|
|
>
|
|
> 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()): ...
|
|
|
|
no definetly not.
|
|
|
|
|
|
If you don't like while 1 why don't you try s.th like:
|
|
|
|
|
|
false = 0
|
|
true = 1
|
|
|
|
|
|
exit = false;
|
|
while exit != true:
|
|
|
|
|
|
|
|
|
|
>
|
|
> That is my only complaint about python, that statements cannot be
|
|
> expressions.
|
|
|
|
I havn't any problems with that. Ok it makes C so terse and it's nice
|
|
just to write some stuff but I completly dislike the following.
|
|
|
|
|
|
if ((fd = fopen("whatever", modus)) == NULL))
|
|
/* here is error handling */
|
|
|
|
|
|
or even worse
|
|
if ((fd1 = fd2 = fopen("whatever", modus)) == NULL))
|
|
|
|
this clutters this line very much. Where's computation where is error
|
|
handling this is just one example where in one line too much is mixed
|
|
together. So better is not having that at all IMO
|
|
|
|
Till then
|
|
Friedrich
|
|
|
|
|
|
|
|
|