This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author intellimath
Recipients Russell.Sim, YoSTEALTH, dlenski, eric.araujo, erlendaasland, ghaering, intellimath, ncoghlan, petri.lehtinen, rhettinger, serhiy.storchaka
Date 2021-08-05.07:15:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:53intellimathsetrecipients: + intellimath, rhettinger, ghaering, ncoghlan, eric.araujo, petri.lehtinen, serhiy.storchaka, dlenski, Russell.Sim, YoSTEALTH, erlendaasland
2021-08-05 07:15:53intellimathsetmessageid: <>
2021-08-05 07:15:53intellimathlinkissue13299 messages
2021-08-05 07:15:53intellimathcreate