Message398970
Instead of using cache, maybe better to use mutable default argument?
For example:
def make_row_factory(cls_factory, **kw):
def row_factory(cursor, row, cls=[None]):
rf = cls[0]
if rf is None:
fields = [col[0] for col in cursor.description]
cls[0] = cls_factory("Row", fields, **kw)
return cls[0](*row)
return rf(*row)
return row_factory
namedtuple_row_factory = make_row_factory(namedtuple)
Seem it should add less overhead. |
|
Date |
User |
Action |
Args |
2021-08-05 07:15:53 | intellimath | set | recipients:
+ intellimath, rhettinger, ghaering, ncoghlan, eric.araujo, petri.lehtinen, serhiy.storchaka, dlenski, Russell.Sim, YoSTEALTH, erlendaasland |
2021-08-05 07:15:53 | intellimath | set | messageid: <1628147753.4.0.865582360645.issue13299@roundup.psfhosted.org> |
2021-08-05 07:15:53 | intellimath | link | issue13299 messages |
2021-08-05 07:15:53 | intellimath | create | |
|