<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>---------- Forwarded message ----------<br>From: Martin Bammer <<a href="mailto:mrbm74@gmail.com" target="_blank">mrbm74@gmail.com</a>><br>To: <a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a><br>Cc: <br>Bcc: <br>Date: Sat, 1 Sep 2018 09:47:04 +0200<br>Subject: [Python-ideas] Add recordlcass to collections module<br>Hi,<br>
<br>
what about adding recordclass <br>
(<a href="https://bitbucket.org/intellimath/recordclass" rel="noreferrer" target="_blank">https://bitbucket.org/intellimath/recordclass</a>) to the collections module<br>
<br>
It is like namedtuple, but elements are writable and it is written in C <br>
and thus much faster.<br>
<br>
And for convenience it could be named as namedlist.<br>
<br>
Regards,<br>
<br>
Martin<br><br></blockquote><div><br></div><div>There are a problem which prevent you to reach your goals.</div><div><br></div><div>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. </div><div><br></div><div>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 <a href="https://docs.python.org/3/library/dis.html#opcode-LOAD_ATTR">https://docs.python.org/3/library/dis.html#opcode-LOAD_ATTR</a></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div>