while (a=b()) ...

Michael Hudson mwh21 at cam.ac.uk
Tue May 11 18:07:16 EDT 1999


Hear hear!

"Fredrik Lundh" <fredrik at pythonware.com> writes:
> scott cotton <scott at chronis.pobox.com> wrote:
> > >c=curs.fetchone()
> > >while c:
> > >    do something with c
> > >    c=curs.fetchone()
> > >
> > >Is it a little redundant? Yes.  Error prone?  No.
> > 
> > Error prone it is - by virtue of being redundant. changes to
> > the loop may require changing two code lines, and it's easy
> > to forget to update redundant code.
> 
> so don't use it. use the Standard Python Idiom
> That Everyone Else Uses instead (see below).

SPITEEU? That's a bit ugly...

[snip well put rant in favour of status quo and using while 1:]
 
> now, has anyone written any useful Python code today?

No.

> </F>

(Basically a me too post)

Michael




More information about the Python-list mailing list