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

Pablo Prieto pablo.prieto at dulcesol.es
Fri Aug 11 07:32:16 EDT 2000


> into the equivalent Python idiom:
>
>     while 1:
>         row=c.fetchone()
>         if not row: break
>         doit(row)
>
> Alternatives abound, e.g:
>
> class valueWrapper:
>     def set(self,value):
>         self.value=value
>         return value
>
> row=valueWrapper()
>
> while row.set(c.fetchone()):
>     doit(row.value)
>
> Alex

How I do it:

t = c.fetchone()
while t
  --- # Very intelligent code goes here :)
  t = c.fetchone()

Have a nice day!
Pablo Prieto.




More information about the Python-list mailing list