>
>
> ---------- Forwarded message ----------
> From: Martin Bammer <mrb...@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
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to