[Python-ideas] namedtuple with ordereddict

Serhiy Storchaka storchaka at gmail.com
Wed Jul 19 02:48:15 EDT 2017


19.07.17 01:33, Greg Ewing пише:
> Jim J. Jewett wrote:
>> is there any reason not to simply define it as a view on a dict, or at
>> least as a limited proxy to one?
> 
> Some valuable characteristics of namedtuples as they are now:
> 
> * Instances are very lightweight
> * Access by index is fast
> * Can be used as a dict key

* Are tuple subclasses. This is important for compatibility with tuples, 
because namedtuples usually are used as replacements for tuples.



More information about the Python-ideas mailing list