Python Language Tuple
Jump to navigation
Jump to search
Internal
Overview
A tuple is a immutable sequence type that contains zero or more elements and whose elements can be of different types. Once a tuple is defined, you can't add, delete or change items. A tuple is similar to a constant list, and could be used instead of a list, if we can afford the "list" to be immutable. Naturally, the list's mutating functions append()
, insert()
do not exist on tuples.
Declaration
Conversion from other Data Structures
Tuple Unpacking
Exchanging Variable Values
Tuples can be used to exchange to variable values without using a third temporary variable.