Files
chat/venv/lib/python3.12/site-packages/mypyc/doc/tuple_operations.rst
Andrew K. Choi ddce9f5125
All checks were successful
continuous-integration/drone/push Build is passing
Major fixes and new features
2025-09-25 15:51:48 +09:00

34 lines
732 B
ReStructuredText

.. _tuple-ops:
Native tuple operations
=======================
These ``tuple`` operations have fast, optimized implementations. Other
tuple operations use generic implementations that are often slower.
Unless mentioned otherwise, these operations apply to both fixed-length
tuples and variable-length tuples.
Construction
------------
* ``item0, ..., itemN`` (construct a tuple)
* ``tuple(lst: list)`` (construct a variable-length tuple)
* ``tuple(lst: Iterable)`` (construct a variable-length tuple)
Operators
---------
* ``tup[n]`` (integer index)
* ``tup[n:m]``, ``tup[n:]``, ``tup[:m]`` (slicing)
Statements
----------
* ``item0, ..., itemN = tup`` (for fixed-length tuples)
Functions
---------
* ``len(tup: tuple)``