On Tue, 19 Sep 2006 09:49:22 +0200
Simon Pamies <[EMAIL PROTECTED]> wrote:
> > Also, I will probably remove the lambda function and just make it a
> > simple method.
>
> If I may ask: Why? For this usecase the lambda function is clean and
> simple :-)
To some extent I just want to stay away from the poltics. Search the
web to see the controversy over lambda. Besides, I do find the second
line below clearer than the first.
self.row_factory = lambda cur, row: row
def row_factory(cur, row): return row
In fact, let's make your comment a docstring:
def row_factory(cur, row):
"""you can overwrite this with a custom row factory
e.g. a dict_factory
cursor = pgdbCursor(src, cache)
def cursor.row_factory(caller, row):
d = {}
for idx, col in enumerate(caller.description):
d[col[0]] = row[idx]
return d
"""
return row
--
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql