A note on Python Collections.NamedTuple()
Published in
2 min readNov 16, 2022
Why does this exist?
It makes you write more pythonic code. When you use a regular tuple, we need to use indices to fetch tuple values which can be error-prone especially when you have multiple values in a tuple. Named tuple solves the issue by giving us the ability to name the values and make our code more readable. Also, note that they have similar memory consumption to regular tuples.