[Python-Dev] Impact of Namedtuple on startup time

Victor Stinner victor.stinner at gmail.com
Mon Jul 17 12:25:23 EDT 2017


2017-07-17 18:13 GMT+02:00 Gregory P. Smith <greg at krypto.org>:
> I get that namedtuple ._source is a public API. We may need to keep it. If
> so, that just means revisiting lazily generating it as a property -
> issue19640.

I agree. Technically speaking, optimizing namedtuple doesn't have to
mean "remove the _source attribute".

I wouldn't discuss here if _source should be kept or not, but even if
we rewrite the namedtuple implementation, I agree that we *can*
technically keep a _source property which would create the same Python
code. It would allow it to speedup namedtuple, reduce the memory
footprint, and have a smooth deprecation policy (*if* we decide to
deprecate this attribute).

Victor


More information about the Python-Dev mailing list