AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
Using a Named Tupple in Python
In python we have lists. Lists are completely mutable. A tupple in python is an immutable list. So it's essentially a list, and you have list access just the way you have a normally. But you can't, say, pop an element toupple. You can't reorder the elements. And so a named tupple allows you to use that immutable data structure, but assign names to the slots. Instead of like getting at the zerot element, the first element, you can say, the zeroth element is the name,. The second element is, you know, the person's age, and things like that.