Differences creating tuples and collections.namedtuples

John Reid johnbaronreid at gmail.com
Mon Feb 18 14:51:06 CET 2013


On 18/02/13 12:03, Oscar Benjamin wrote:
> On 18 February 2013 11:47, John Reid <johnbaronreid at gmail.com> wrote:
>> Hi,
>>
>> I was hoping namedtuples could be used as replacements for tuples in all instances.
> namedtuples are not really intended to serves as tuples anywhere. They
> are intended to provide lightweight, immutable, hashable objects with
> *named* (rather than numbered) values.
If they are not supposed to be tuples then calling them namedtuples and
inheriting from tuple seems a little odd.




More information about the Python-list mailing list