From: nathan at islanddata.com (Nathan Clegg)
Date: Thu, 29 Apr 1999 16:48:39 -0700 (PDT)
Subject: while (a=b()) ...
In-Reply-To: <19990430000141.A5867@shalott>
Message-ID: <XFMail.990429164839.nathan@islanddata.com>
Content-Length: 1214
X-UID: 1344                                                  

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.



On 30-Apr-99 Marco Mariani wrote:
> Hi all language lawyers!
> 
> Which one is more ugly?
> 
> 
> 
> =====
> 
> c = curs.fetchone()
> while c:
>         print c
>         c = curs.fetchone()
> 
> =====
> 
> while 1:
>       c = curs.fetchone()
>       if c:
>               print c
>       else:
>               break
> 
> =====
> 
> Is there an elegant way?
> 
> 
> while curs.fetchone()
>       print $_
> 
> 
>:-)))
> 
> 
> 
> -- 
> "If you're going to kill someone there isn't much reason to get all
> worked
>  up about it and angry.  Any discussions beforehand are a waste of time.
>  We need to smile at Novell while we pull the trigger."
> 
>  - Jim Allchin, Microsoft corp. -
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list



----------------------------------
Nathan Clegg
 nathan at islanddata.com






