3 ms·
I doubt that because defining a namedtuple just creates a new class internally: https://github.com/python/cpython/blob/master/Lib/collections/__init__.py#L304 h
by skrause 10y ago
I doubt that because defining a namedtuple just creates a new class internally: https://github.com/python/cpython/blob/master/Lib/collections/__init__.py#L304 https://github.com/python/cpython/blob/master/Lib/collection...
Class creation the very expensive in Python, so Guido van Rossum explicitly recommends against using dynamically created namedtuples: https://mail.python.org/pipermail//python-ideas/2016-April/039867.html https://mail.python.org/pipermail//python-ideas/2016-April/0...
- tcbawo 10y agoI believe that objects of namedtuple have less runtime overhead than a class. Guido seems to point out that the process of instantiating a namedtuple class is expensive.