3 ms·
> Not a Python expert, but I think tuples might be enumerable in Python Yes, they are. More generally, they are sequences and they support indexing, so they ar
by klibertp 9y ago
> Not a Python expert, but I think tuples might be enumerable in Python
Yes, they are. More generally, they are sequences and they support indexing, so they are also iterable. In other words, this Python code works:
list(map(str, ("tuple", 5, {}))) == ["tuple", "5", "{}"]
There is also a variant of a tuple which assigns names to its positions - it's also iterable. They are also allowed to have any length. Other than that, I'm not aware of any superpowers of Python tuples.