New submission from STINNER Victor: The definition of a new nametuple creates a large Python script to create the new type. The code stores the code in a private attribute:
namespace = dict(__name__='namedtuple_%s' % typename) exec(class_definition, namespace) result = namespace[typename] result._source = class_definition This attribute wastes memory, I don't understand the purpose of the attribute. It was not discussed in an issue, so I guess that there is no real use case: changeset: 68879:bffdd7e9265c user: Raymond Hettinger <pyt...@rcn.com> date: Wed Mar 23 12:52:23 2011 -0700 files: Doc/library/collections.rst Lib/collections/__init__.py Lib/test/test_collections.py description: Expose the namedtuple source with a _source attribute. Can we just drop this attribute to reduce the Python memory footprint? ---------- messages: 203270 nosy: haypo, rhettinger priority: normal severity: normal status: open title: Drop _source attribute of namedtuple versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19640> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com