View Source Pythonx.C.PyTuple (Pythonx v0.2.2)
This subtype of PyObject represents a Python tuple object.
Summary
Functions
Return true
if p
is a tuple object or an instance of a subtype of the tuple type.
Return true
if p
is a tuple object, but not an instance of a subtype of the tuple type.
Return the object at position pos
in the tuple pointed to by p
.
Return the slice of the tuple pointed to by p
between low
and high
, or PyErr
with an exception set on failure.
Return a new tuple object of size len
, or PyErr
with an exception set on failure.
Take a pointer to a tuple object, and return the size of that tuple. On error, return PyErr
and with an exception set.
Functions
@spec check(Pythonx.C.PyObject.t()) :: boolean()
Return true
if p
is a tuple object or an instance of a subtype of the tuple type.
This function always succeeds.
@spec check_exact(Pythonx.C.PyObject.t()) :: boolean()
Return true
if p
is a tuple object, but not an instance of a subtype of the tuple type.
This function always succeeds.
@spec get_item(Pythonx.C.PyObject.t(), integer()) :: Pythonx.C.PyObject.borrowed() | PyErr.t()
Return the object at position pos
in the tuple pointed to by p
.
If pos
is negative or out of bounds, return PyErr
with an IndexError
exception.
The returned reference is borrowed from the tuple p
(that is: it is only valid as long
as you hold a reference to p
).
To get a strong reference, use Pythonx.C.new_ref/1
or Pythonx.C.PySequence.get_item/2
.
@spec get_slice(Pythonx.C.PyObject.t(), integer(), integer()) :: Pythonx.C.PyObject.t() | PyErr.t()
Return the slice of the tuple pointed to by p
between low
and high
, or PyErr
with an exception set on failure.
This is the equivalent of the Python expression p[low:high]
.
Indexing from the end of the tuple is not supported.
@spec new(integer()) :: Pythonx.C.PyObject.t() | PyErr.t()
Return a new tuple object of size len
, or PyErr
with an exception set on failure.
Return value: New reference.
@spec size(Pythonx.C.PyObject.t()) :: integer() | PyErr.t()
Take a pointer to a tuple object, and return the size of that tuple. On error, return PyErr
and with an exception set.