Dennis Lee Bieber wrote:
> On Sun, 25 Mar 2012 19:09:12 -0400, [email protected] declaimed the
> following in gmane.comp.python.general:
>
>
>> Most of my database programs wind up having the boilerplate (not tested):
>>
>> def rowsof (cursor):
>> names = [x[0] for x in cursor.description]
>> r = cursor.fetchone()
>> while r:
>> yield dict (zip (names, r))
>> r = cursor.fetchone()
>>
>
> In my (limited) experience, the main loop above could be replaced
> with:
>
> for r in cursor:
> yield dict(zip(names, r))
I think your experience is more recent than mine. I'll change my
boilerplate next time around.
Mel.
--
http://mail.python.org/mailman/listinfo/python-list