tuple

Tuples are immutable sequences.

tuple([iterable])

The constructor builds a tuple whose items are the same and
in the same order as iterable‘s items.

iterable may be a sequence,
a container that supports iteration, or an iterable object.

If iterable is already a tuple, it is returned unchanged.

  • Empty tuple: (), tuple()
  • Singleton tuple: 'a',, (‘a’,)
  • Multiple elements tuple: 'a', 0, ('a', 0), tuple(iterable)
  • t.count(x)

    return number of occurrences of x, if no x in the tuple
    a 0 value will be returned.

  • t.index(x, start=None, stop=None)

    Return first index of x. Raises ValueError if the x is not present.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
class tuple(object):
"""
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable's items

If the argument is a tuple, the return value is the same object.
"""
def count(self, value): # real signature unknown; restored from __doc__
""" T.count(value) -> integer -- return number of occurrences of value """
return 0

def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
"""
T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
"""
return 0

def __add__(self, *args, **kwargs): # real signature unknown
""" Return self+value. """
pass

def __contains__(self, *args, **kwargs): # real signature unknown
""" Return key in self. """
pass

def __eq__(self, *args, **kwargs): # real signature unknown
""" Return self==value. """
pass

def __getattribute__(self, *args, **kwargs): # real signature unknown
""" Return getattr(self, name). """
pass

def __getitem__(self, *args, **kwargs): # real signature unknown
""" Return self[key]. """
pass

def __getnewargs__(self, *args, **kwargs): # real signature unknown
pass

def __ge__(self, *args, **kwargs): # real signature unknown
""" Return self>=value. """
pass

def __gt__(self, *args, **kwargs): # real signature unknown
""" Return self>value. """
pass

def __hash__(self, *args, **kwargs): # real signature unknown
""" Return hash(self). """
pass

def __init__(self, seq=()): # known special case of tuple.__init__
"""
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable's items

If the argument is a tuple, the return value is the same object.
# (copied from class doc)
"""
pass

def __iter__(self, *args, **kwargs): # real signature unknown
""" Implement iter(self). """
pass

def __len__(self, *args, **kwargs): # real signature unknown
""" Return len(self). """
pass

def __le__(self, *args, **kwargs): # real signature unknown
""" Return self<=value. """
pass

def __lt__(self, *args, **kwargs): # real signature unknown
""" Return self<value. """
pass

def __mul__(self, *args, **kwargs): # real signature unknown
""" Return self*value.n """
pass

@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
""" Create and return a new object. See help(type) for accurate signature. """
pass

def __ne__(self, *args, **kwargs): # real signature unknown
""" Return self!=value. """
pass

def __repr__(self, *args, **kwargs): # real signature unknown
""" Return repr(self). """
pass

def __rmul__(self, *args, **kwargs): # real signature unknown
""" Return self*value. """
pass