The whole *point* is that namedtuples let you use *named fields* rather than indices. That's the point. That's the purpose.
What are the named fields supposed to be if the datastructure is being treated as a sequence? Indices again? Then what's the point of using namedtuple rather than tuple in the first place? Again, I direct you to Christopher's comment on the matter. ------- Original Message ------- On Monday, March 14th, 2022 at 1:07 PM, Chris Angelico <ros...@gmail.com> wrote: > On Tue, 15 Mar 2022 at 04:02, wfdc w...@protonmail.com wrote: > > > > A namedtuple IS a sequence. It is a tuple. They are deliberately designed > > > to be drop-in replacements for tuples. > > > > I meant that they're not meant to be addressed as sequences. That's the > > whole point of namedtuple: to avoid doing that. > > The whole point is that they are both sequences and structures. > > https://docs.python.org/3/library/collections.html#collections.namedtuple > > ChrisA > > _______________________________________________ > > Python-ideas mailing list -- python-ideas@python.org > > To unsubscribe send an email to python-ideas-le...@python.org > > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/5QBJGA4UB3JJ34IULQSFHTBEZGBEFV7U/ > > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/CB5P5W7I2IID2AUMF72F3HKSD3V52UGA/ Code of Conduct: http://python.org/psf/codeofconduct/