From: philh at vision25.demon.co.uk (Phil Hunt)
Date: Fri, 30 Apr 99 01:47:12 GMT
Subject: while (a=b()) ...
References: <19990430000141.A5867@shalott>
Message-ID: <925436832snz@vision25.demon.co.uk>
X-UID: 675                                                  

In article <19990430000141.A5867 at shalott>
           m.mariani at imola.nettuno.it "Marco Mariani" writes:

> 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?
 
How about:

while 1:
   c = curs.fetchone()
   if not c: break
   print c

 
> while curs.fetchone()
>         print $_

This would mean nothing to me if I hadn't already seen the python
examples -- it is very obscure.

-- 
Phil Hunt....philh at vision25.demon.co.uk





