[Python-Dev] Impact of Namedtuple on startup time

Ethan Furman ethan at stoneleaf.us
Mon Jul 17 19:05:38 EDT 2017


On 07/17/2017 02:31 PM, Brett Cannon wrote:

> I vaguely remember some years ago someone proposing a patch that used metaclasses to avoid using exec() (I think it was
> to benefit PyPy or one of the JIT-backed interpreters). Would that work to remove the need for exec() while keeping the
> code in pure Python?

The aenum library [1] uses the same techniques as Enum for a metaclass-based namedtuple.  I don't expect it to be 
faster, but somebody could do the benchmarks and then we'd know for sure.  ;)

--
~Ethan~

[1] https://pypi.python.org/pypi/aenum



More information about the Python-Dev mailing list