while (assignment):
Sybren Stuvel
sybrenUSE at YOURthirdtower.imagination.com
Wed Jul 30 02:41:19 EDT 2003
Peter Abel enlightened us with:
> The following should work:
>
> info = mydbcursor.fetchone()
> while info:
> print "Information: "+str(info)
> info = mydbcursor.fetchone()
I don't really like the double info assignment, but I've thought it
over a bit, and I like this better than the
while True
info = mydbcursor.fetchone()
if not info:
break
construction. In the upper solution the "while info" makes the loop
condition very clear. The lower solution is less clear in that, but
doesn't have the double assignment.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
More information about the Python-list
mailing list