Re: [Python-ideas] Add recordlcass to collections module

---------- Forwarded message ---------- From: Martin Bammer <mrbm74@gmail.com> To: python-ideas@python.org Cc: Bcc: Date: Sat, 1 Sep 2018 09:47:04 +0200 Subject: [Python-ideas] Add recordlcass to collections module Hi,
what about adding recordclass (https://bitbucket.org/intellimath/recordclass) to the collections module
It is like namedtuple, but elements are writable and it is written in C and thus much faster.
And for convenience it could be named as namedlist.
Regards,
Martin
There are a problem which prevent you to reach your goals. As list in Python is already that efficient, a wrapper of this list in C to supply so-called namedlist interface could not be that efficient. Member accessing in Python bytecode requires looking up corresponding attribute in a hashtable, if you want to access a list by attribute, actually there is an overhead. This is nothing to do with C implementation. See https://docs.python.org/3/library/dis.html#opcode-LOAD_ATTR
participants (1)
-
Thautwarm Zhao