Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 1 | .. highlightlang:: c |
| 2 | |
| 3 | .. _sequence: |
| 4 | |
| 5 | Sequence Protocol |
| 6 | ================= |
| 7 | |
| 8 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 9 | .. c:function:: int PySequence_Check(PyObject *o) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 10 | |
| 11 | Return ``1`` if the object provides sequence protocol, and ``0`` otherwise. |
| 12 | This function always succeeds. |
| 13 | |
| 14 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 15 | .. c:function:: Py_ssize_t PySequence_Size(PyObject *o) |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 16 | Py_ssize_t PySequence_Length(PyObject *o) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 17 | |
| 18 | .. index:: builtin: len |
| 19 | |
| 20 | Returns the number of objects in sequence *o* on success, and ``-1`` on failure. |
| 21 | For objects that do not provide sequence protocol, this is equivalent to the |
| 22 | Python expression ``len(o)``. |
| 23 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 24 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 25 | These functions returned an :c:type:`int` type. This might require |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 26 | changes in your code for properly supporting 64-bit systems. |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 27 | |
| 28 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 29 | .. c:function:: PyObject* PySequence_Concat(PyObject *o1, PyObject *o2) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 30 | |
| 31 | Return the concatenation of *o1* and *o2* on success, and *NULL* on failure. |
| 32 | This is the equivalent of the Python expression ``o1 + o2``. |
| 33 | |
| 34 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 35 | .. c:function:: PyObject* PySequence_Repeat(PyObject *o, Py_ssize_t count) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 36 | |
| 37 | Return the result of repeating sequence object *o* *count* times, or *NULL* on |
| 38 | failure. This is the equivalent of the Python expression ``o * count``. |
| 39 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 40 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 41 | This function used an :c:type:`int` type for *count*. This might require |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 42 | changes in your code for properly supporting 64-bit systems. |
| 43 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 44 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 45 | .. c:function:: PyObject* PySequence_InPlaceConcat(PyObject *o1, PyObject *o2) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 46 | |
| 47 | Return the concatenation of *o1* and *o2* on success, and *NULL* on failure. |
| 48 | The operation is done *in-place* when *o1* supports it. This is the equivalent |
| 49 | of the Python expression ``o1 += o2``. |
| 50 | |
| 51 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 52 | .. c:function:: PyObject* PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 53 | |
| 54 | Return the result of repeating sequence object *o* *count* times, or *NULL* on |
| 55 | failure. The operation is done *in-place* when *o* supports it. This is the |
| 56 | equivalent of the Python expression ``o *= count``. |
| 57 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 58 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 59 | This function used an :c:type:`int` type for *count*. This might require |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 60 | changes in your code for properly supporting 64-bit systems. |
| 61 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 62 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 63 | .. c:function:: PyObject* PySequence_GetItem(PyObject *o, Py_ssize_t i) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 64 | |
Georg Brandl | 6a46898 | 2009-05-30 10:33:23 +0000 | [diff] [blame] | 65 | Return the *i*\ th element of *o*, or *NULL* on failure. This is the equivalent of |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 66 | the Python expression ``o[i]``. |
| 67 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 68 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 69 | This function used an :c:type:`int` type for *i*. This might require |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 70 | changes in your code for properly supporting 64-bit systems. |
| 71 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 72 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 73 | .. c:function:: PyObject* PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 74 | |
| 75 | Return the slice of sequence object *o* between *i1* and *i2*, or *NULL* on |
| 76 | failure. This is the equivalent of the Python expression ``o[i1:i2]``. |
| 77 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 78 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 79 | This function used an :c:type:`int` type for *i1* and *i2*. This might |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 80 | require changes in your code for properly supporting 64-bit systems. |
| 81 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 82 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 83 | .. c:function:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 84 | |
Martin Panter | ed82604 | 2016-11-30 10:32:40 +0000 | [diff] [blame] | 85 | Assign object *v* to the *i*\ th element of *o*. Raise an exception |
| 86 | and return ``-1`` on failure; return ``0`` on success. This |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 87 | is the equivalent of the Python statement ``o[i] = v``. This function *does |
| 88 | not* steal a reference to *v*. |
| 89 | |
Martin Panter | ed82604 | 2016-11-30 10:32:40 +0000 | [diff] [blame] | 90 | If *v* is *NULL*, the element is deleted, however this feature is |
| 91 | deprecated in favour of using :c:func:`PySequence_DelItem`. |
| 92 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 93 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 94 | This function used an :c:type:`int` type for *i*. This might require |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 95 | changes in your code for properly supporting 64-bit systems. |
| 96 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 97 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 98 | .. c:function:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 99 | |
Georg Brandl | 6a46898 | 2009-05-30 10:33:23 +0000 | [diff] [blame] | 100 | Delete the *i*\ th element of object *o*. Returns ``-1`` on failure. This is the |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 101 | equivalent of the Python statement ``del o[i]``. |
| 102 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 103 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 104 | This function used an :c:type:`int` type for *i*. This might require |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 105 | changes in your code for properly supporting 64-bit systems. |
| 106 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 107 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 108 | .. c:function:: int PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 109 | |
| 110 | Assign the sequence object *v* to the slice in sequence object *o* from *i1* to |
Martin Panter | ed82604 | 2016-11-30 10:32:40 +0000 | [diff] [blame] | 111 | *i2*. Raise an exception and return ``-1`` on failure; return ``0`` on success. |
| 112 | This is the equivalent of the Python statement ``o[i1:i2] = v``. |
| 113 | |
| 114 | If *v* is *NULL*, the slice is deleted, however this feature is |
| 115 | deprecated in favour of using :c:func:`PySequence_DelSlice`. |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 116 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 117 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 118 | This function used an :c:type:`int` type for *i1* and *i2*. This might |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 119 | require changes in your code for properly supporting 64-bit systems. |
| 120 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 121 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 122 | .. c:function:: int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 123 | |
| 124 | Delete the slice in sequence object *o* from *i1* to *i2*. Returns ``-1`` on |
| 125 | failure. This is the equivalent of the Python statement ``del o[i1:i2]``. |
| 126 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 127 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 128 | This function used an :c:type:`int` type for *i1* and *i2*. This might |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 129 | require changes in your code for properly supporting 64-bit systems. |
| 130 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 131 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 132 | .. c:function:: Py_ssize_t PySequence_Count(PyObject *o, PyObject *value) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 133 | |
| 134 | Return the number of occurrences of *value* in *o*, that is, return the number |
| 135 | of keys for which ``o[key] == value``. On failure, return ``-1``. This is |
| 136 | equivalent to the Python expression ``o.count(value)``. |
| 137 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 138 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 139 | This function returned an :c:type:`int` type. This might require changes |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 140 | in your code for properly supporting 64-bit systems. |
| 141 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 142 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 143 | .. c:function:: int PySequence_Contains(PyObject *o, PyObject *value) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 144 | |
| 145 | Determine if *o* contains *value*. If an item in *o* is equal to *value*, |
| 146 | return ``1``, otherwise return ``0``. On error, return ``-1``. This is |
| 147 | equivalent to the Python expression ``value in o``. |
| 148 | |
| 149 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 150 | .. c:function:: Py_ssize_t PySequence_Index(PyObject *o, PyObject *value) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 151 | |
| 152 | Return the first index *i* for which ``o[i] == value``. On error, return |
| 153 | ``-1``. This is equivalent to the Python expression ``o.index(value)``. |
| 154 | |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 155 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 156 | This function returned an :c:type:`int` type. This might require changes |
Jeroen Ruigrok van der Werven | 089c5cd | 2009-04-25 17:59:03 +0000 | [diff] [blame] | 157 | in your code for properly supporting 64-bit systems. |
| 158 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 159 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 160 | .. c:function:: PyObject* PySequence_List(PyObject *o) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 161 | |
| 162 | Return a list object with the same contents as the arbitrary sequence *o*. The |
| 163 | returned list is guaranteed to be new. |
| 164 | |
| 165 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 166 | .. c:function:: PyObject* PySequence_Tuple(PyObject *o) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 167 | |
| 168 | .. index:: builtin: tuple |
| 169 | |
| 170 | Return a tuple object with the same contents as the arbitrary sequence *o* or |
| 171 | *NULL* on failure. If *o* is a tuple, a new reference will be returned, |
| 172 | otherwise a tuple will be constructed with the appropriate contents. This is |
| 173 | equivalent to the Python expression ``tuple(o)``. |
| 174 | |
| 175 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 176 | .. c:function:: PyObject* PySequence_Fast(PyObject *o, const char *m) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 177 | |
Benjamin Peterson | 96c9a35 | 2014-04-08 10:48:36 -0400 | [diff] [blame] | 178 | Return the sequence *o* as a list, unless it is already a tuple or list, in |
| 179 | which case *o* is returned. Use :c:func:`PySequence_Fast_GET_ITEM` to access |
| 180 | the members of the result. Returns *NULL* on failure. If the object is not |
| 181 | a sequence, raises :exc:`TypeError` with *m* as the message text. |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 182 | |
| 183 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 184 | .. c:function:: PyObject* PySequence_Fast_GET_ITEM(PyObject *o, Py_ssize_t i) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 185 | |
Georg Brandl | 6a46898 | 2009-05-30 10:33:23 +0000 | [diff] [blame] | 186 | Return the *i*\ th element of *o*, assuming that *o* was returned by |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 187 | :c:func:`PySequence_Fast`, *o* is not *NULL*, and that *i* is within bounds. |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 188 | |
Jeroen Ruigrok van der Werven | 3637871 | 2009-04-25 20:50:27 +0000 | [diff] [blame] | 189 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 190 | This function used an :c:type:`int` type for *i*. This might require |
Jeroen Ruigrok van der Werven | 3637871 | 2009-04-25 20:50:27 +0000 | [diff] [blame] | 191 | changes in your code for properly supporting 64-bit systems. |
| 192 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 193 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 194 | .. c:function:: PyObject** PySequence_Fast_ITEMS(PyObject *o) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 195 | |
| 196 | Return the underlying array of PyObject pointers. Assumes that *o* was returned |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 197 | by :c:func:`PySequence_Fast` and *o* is not *NULL*. |
Georg Brandl | c62ef8b | 2009-01-03 20:55:06 +0000 | [diff] [blame] | 198 | |
Raymond Hettinger | 8dbbb96 | 2008-07-11 12:00:21 +0000 | [diff] [blame] | 199 | Note, if a list gets resized, the reallocation may relocate the items array. |
Georg Brandl | c62ef8b | 2009-01-03 20:55:06 +0000 | [diff] [blame] | 200 | So, only use the underlying array pointer in contexts where the sequence |
Raymond Hettinger | 8dbbb96 | 2008-07-11 12:00:21 +0000 | [diff] [blame] | 201 | cannot change. |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 202 | |
| 203 | .. versionadded:: 2.4 |
| 204 | |
| 205 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 206 | .. c:function:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 207 | |
Georg Brandl | 6a46898 | 2009-05-30 10:33:23 +0000 | [diff] [blame] | 208 | Return the *i*\ th element of *o* or *NULL* on failure. Macro form of |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 209 | :c:func:`PySequence_GetItem` but without checking that |
| 210 | :c:func:`PySequence_Check` on *o* is true and without adjustment for negative |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 211 | indices. |
| 212 | |
| 213 | .. versionadded:: 2.3 |
| 214 | |
Jeroen Ruigrok van der Werven | 3637871 | 2009-04-25 20:50:27 +0000 | [diff] [blame] | 215 | .. versionchanged:: 2.5 |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 216 | This function used an :c:type:`int` type for *i*. This might require |
Jeroen Ruigrok van der Werven | 3637871 | 2009-04-25 20:50:27 +0000 | [diff] [blame] | 217 | changes in your code for properly supporting 64-bit systems. |
| 218 | |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 219 | |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 220 | .. c:function:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o) |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 221 | |
| 222 | Returns the length of *o*, assuming that *o* was returned by |
Sandro Tosi | 98ed08f | 2012-01-14 16:42:02 +0100 | [diff] [blame] | 223 | :c:func:`PySequence_Fast` and that *o* is not *NULL*. The size can also be |
| 224 | gotten by calling :c:func:`PySequence_Size` on *o*, but |
| 225 | :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list |
Georg Brandl | f684272 | 2008-01-19 22:08:21 +0000 | [diff] [blame] | 226 | or tuple. |