[Python-ideas] Add recordlcass to collections module
yaoxiansamma at gmail.com
Sat Sep 1 14:22:11 EDT 2018
> ---------- Forwarded message ----------
> From: Martin Bammer <mrbm74 at gmail.com>
> To: python-ideas at python.org
> Date: Sat, 1 Sep 2018 09:47:04 +0200
> Subject: [Python-ideas] Add recordlcass to collections module
> 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.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas