#python #programming #language #efficiency
- Tuples: Records if the same information on the same position
- Can be used as immutable list if its size does not change
- Use less memory
- Inside mutable objects tuple does not change, but a new tuple is created [[1zto-shallow-and-deep-copy]]
- They are two subclasses of
tuples
used to store records/hold data. They are- [[01o9-collections-namedtuple]]#
- [[07fk-typing-namedtuple]]#
- How to type tuples: [[o4v3-typing-tuple]]#
Warning
BUG: Tuple with mutable items can be a source of bugs. AVOID!
Warning
sort
return a new object for tuple. Take a look on [[pcvu-sort-and-sorted]].
Ramalho, 2022, Chapter 1