[Fwd: while row = c.fetchone(): # syntax error???]

Pablo Prieto pablo.prieto at dulcesol.es
Fri Aug 11 08:25:33 EDT 2000


First, I forgot the ':' in while t

> > How I do it:
> >
> > t = c.fetchone()
> > while t
> >   --- # Very intelligent code goes here :)
> >   t = c.fetchone()
> 
> And now for the "official" Python idiom, which avoids duplication of the
> t = c.fetchone() line:
> 
> while 1:
>     t = c.fetchone()
>     if not t:
>         break
>     --- # Very intelligent code goes here :)

If that a joke, isn't it?

Pablo.




More information about the Python-list mailing list