variable assignment in "while" loop

Daniel Dittmar daniel.dittmar at sap.com
Tue Jul 29 12:49:35 EDT 2003


sismex01 at hebmex.com wrote:
> Are you sure about this?  Because, if you have to iterate
> through .fetchall()  (for example), then the cursor isn't
> actually an iterable object, the result of fetchall() is

That cursors are iterable belongs to the optional extensions of the DB API
spec so you can't expect that to work for all drivers.

Due to the dynamic nature of Python, it's quite easy to add the methods
.next () and .__iter__ () at runtime to the cursor class (if the driver is
written in Python and not an extension).

Daniel







More information about the Python-list mailing list