Professional Documents
Culture Documents
0)
4.2. Tuples
SEARCH
Contents
Tuples Go
Constructing tuples Enter search terms
Tuple methods or a module, class or
Interests of tuples function name.
Misc This page: Show
source.
In Python, tuples are part of the standard language.
TABLE OF
This is a data structure very similar to the list data CONTENTS
structure. The main difference being that tuple
1. Quick Start /
manipulation are faster than list because tuples are
Tutorial
immutable.
2. Variables,
expressions,
4.2.1. Constructing tuples ¶ statements,
To create a tuple, place values within brackets: types
https://thomas-cokelaer.info/tutorials/python/tuples.html 1/4
2021/5/13 4.2. Tuples — Python Notes (0.14.0)
6. Namespace and
https://thomas-cokelaer.info/tutorials/python/tuples.html 2/4
2021/5/13 4.2. Tuples — Python Notes (0.14.0)
Warning
Consider the following function:
5. Classes
4.2.4.3. Copy a tuple 6. Namespace and
To copy a tuple, just use the assignement: scoping rules
10. Notes on
https://thomas-cokelaer.info/tutorials/python/tuples.html 3/4
2021/5/13 4.2. Tuples — Python Notes (0.14.0)
1. Iterators
2. Generators
3. Exceptions
4. Decorators
5. Classes
6. Namespace and
scoping rules
7. Packaging
8. Notes about
sorting lists and
dictionaries
9. Notes about
booleans and
logical operators
10. Notes on
https://thomas-cokelaer.info/tutorials/python/tuples.html 4/4