Top Description Fields Constructors Methods
org.python.core

public Class PyTuple

extends PySequenceList
Class Inheritance
Known Direct Subclasses
org.python.core.PyTupleDerived, org.python.modules.posix.PyStatResult, org.python.modules.time.PyTimeTuple, org.python.core.PyVersionInfo, org.python.core.FloatInfo, org.python.core.LongInfo, org.python.core.WinVersion
Annotations
@ExposedType
name:tuple
base:PyObject
doc:tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable\'s items If the argument is a tuple, the return value is the same object.
Imports
java.util.Arrays, .Collection, .Iterator, .List, .ListIterator, java.lang.reflect.Array, org.python.expose.ExposedMethod, .ExposedNew, .ExposedType, .MethodType

A builtin python tuple.

Field Summary

Modifier and TypeField and Description
private final PyObject[]
private volatile List<PyObject>
public static final PyType

Constructor Summary

AccessConstructor and Description
public
public
PyTuple(PyObject... elements)

public
PyTuple(PyType subtype, PyObject[] elements)

public
PyTuple(PyObject[] elements, boolean copy)

public
PyTuple(PyType subtype, PyObject[] elements, boolean copy)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__add__(PyObject
the object to perform this binary operation with (the right-hand operand).
generic_other
)

Overrides org.python.core.PyObject.__add__.

Equivalent to the standard Python __add__ method.

public PyTuple
public PyObject
__iter__()

Overrides org.python.core.PySequence.__iter__.

Return an iterator that is used to iterate the element of this sequence.

public int
__len__()

Overrides org.python.core.PyObject.__len__.

Equivalent to the standard Python __len__ method.

public PyObject
__mul__(PyObject
the object to perform this binary operation with (the right-hand operand).
o
)

Overrides org.python.core.PyObject.__mul__.

Equivalent to the standard Python __mul__ method.

public PyObject
__rmul__(PyObject
the object to perform this binary operation with (the left-hand operand).
o
)

Overrides org.python.core.PyObject.__rmul__.

Equivalent to the standard Python __rmul__ method.

public boolean
add(Object
element to be appended to this list
o
)

Implements abstract org.python.core.PySequenceList.add.

Implements java.util.List.add.

Appends the specified element to the end of this list (optional operation).

public void
add(int
index at which the specified element is to be inserted
index
,
Object
element to be inserted
element
)

Implements abstract org.python.core.PySequenceList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list (optional operation).

public boolean
addAll(Collection<E>
collection containing elements to be added to this list
coll
)

Implements abstract org.python.core.PySequenceList.addAll.

Implements java.util.List.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

public boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<E>
collection containing elements to be added to this list
c
)

Implements abstract org.python.core.PySequenceList.addAll.

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

public void
clear()

Implements abstract org.python.core.PySequenceList.clear.

Implements java.util.List.clear.

Removes all of the elements from this list (optional operation).

public boolean
contains(Object
element whose presence in this list is to be tested
o
)

Implements abstract org.python.core.PySequenceList.contains.

Implements java.util.List.contains.

Returns true if this list contains the specified element.

public boolean
containsAll(Collection<E>
collection to be checked for containment in this list
c
)

Implements abstract org.python.core.PySequenceList.containsAll.

Implements java.util.List.containsAll.

Returns true if this list contains all of the elements of the specified collection.

public int
count(PyObject value)

public boolean
equals(Object
the object to be compared for equality with this list
other
)

Implements abstract org.python.core.PySequenceList.equals.

Implements java.util.List.equals.

Compares the specified object with this list for equality.

private static PyTuple
public static PyTuple

Returns:

a PyTuple containing each item in the iterable
fromIterable
(PyObject
an iterable PyObject
iterable
)

Return a new PyTuple from an iterable.

public Object
get(int
index of the element to return
index
)

Implements abstract org.python.core.PySequenceList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

public PyObject[]
getArray()

Implements abstract org.python.core.PySequenceList.getArray.

Get the backing array.

pack-priv List<PyObject>
protected PyObject
getslice(int
the position of the first element.
start
,
int
one more than the position of the last element.
stop
,
int
the step size.
step
)

Implements abstract org.python.core.PySequence.getslice.

Returns a range of elements from the sequence.

public int
hashCode()

Implements abstract org.python.core.PySequenceList.hashCode.

Implements java.util.List.hashCode.

Returns the hash code value for this list.

public int
index(PyObject value)

public int
index(PyObject value, int start)

public int
index(PyObject value, int start, int stop)

public int
indexOf(Object
element to search for
o
)

Implements abstract org.python.core.PySequenceList.indexOf.

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

public boolean
isEmpty()

Implements abstract org.python.core.PySequenceList.isEmpty.

Implements java.util.List.isEmpty.

Returns true if this list contains no elements.

public Iterator<E>
iterator()

Implements abstract org.python.core.PySequenceList.iterator.

Implements java.util.List.iterator.

Returns an iterator over the elements in this list in proper sequence.

public int
lastIndexOf(Object
element to search for
o
)

Implements abstract org.python.core.PySequenceList.lastIndexOf.

Implements java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

public ListIterator<E>
listIterator()

Implements abstract org.python.core.PySequenceList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).

public ListIterator<E>
listIterator(final int
index of the first element to be returned from the list iterator (by a call to next)
index
)

Implements abstract org.python.core.PySequenceList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.

public void
pyadd(int index, PyObject element)

Implements abstract org.python.core.PySequenceList.pyadd.

public boolean
public PyObject
pyget(int
index of element to return.
index
)

Implements abstract org.python.core.PySequenceList.pyget.

Returns the element of the sequence at the given index.

public void
pyset(int
index of the element to set.
index
,
PyObject
the value to set this element to.
value
)

Implements abstract org.python.core.PySequenceList.pyset.

Sets the indexed element of the sequence to the given value.

public boolean
public boolean
remove(Object
element to be removed from this list, if present
o
)

Implements abstract org.python.core.PySequenceList.remove.

Implements java.util.List.remove.

Removes the first occurrence of the specified element from this list, if it is present (optional operation).

public Object
remove(int
the index of the element to be removed
index
)

Implements abstract org.python.core.PySequenceList.remove.

Implements java.util.List.remove.

Removes the element at the specified position in this list (optional operation).

public void
remove(int start, int stop)

Implements abstract org.python.core.PySequenceList.remove.

public boolean
removeAll(Collection<E>
collection containing elements to be removed from this list
coll
)

Implements abstract org.python.core.PySequenceList.removeAll.

Implements java.util.List.removeAll.

Removes from this list all of its elements that are contained in the specified collection (optional operation).

protected PyObject
repeat(int
the number of times to repeat the sequence.
count
)

Implements abstract org.python.core.PySequence.repeat.

Returns a (concrete subclass of) PySequence that repeats the given sequence, as in the implementation of __mul__ for strings.

public boolean
retainAll(Collection<E>
collection containing elements to be retained in this list
coll
)

Implements abstract org.python.core.PySequenceList.retainAll.

Implements java.util.List.retainAll.

Retains only the elements in this list that are contained in the specified collection (optional operation).

public Object
set(int
index of the element to replace
index
,
Object
element to be stored at the specified position
element
)

Implements abstract org.python.core.PySequenceList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

public int
size()

Implements abstract org.python.core.PySequenceList.size.

Implements java.util.List.size.

Returns the number of elements in this list.

public List<E>
subList(int
low endpoint (inclusive) of the subList
fromIndex
,
int
high endpoint (exclusive) of the subList
toIndex
)

Implements abstract org.python.core.PySequenceList.subList.

Implements java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

private String
public Object[]
toArray()

Implements abstract org.python.core.PySequenceList.toArray.

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

public Object[]
toArray(Object[]
the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
converted
)

Implements abstract org.python.core.PySequenceList.toArray.

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

public String
toString()

Implements abstract org.python.core.PySequenceList.toString.

Returns a string representation of the object.

public int
traverse(Visitproc visit, Object arg)

Overrides org.python.core.PySequenceList.traverse.

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

pack-priv final PyObject
tuple___add__(PyObject generic_other)

pack-priv final boolean
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyTuple
pack-priv final PyObject
tuple___getslice__(PyObject s_start, PyObject s_stop, PyObject s_step)

pack-priv final PyObject
pack-priv final int
public PyObject
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final String
pack-priv final PyObject
pack-priv final int
pack-priv final int
tuple_index(PyObject value, PyObject start, PyObject stop)

pack-priv final int
tuple_index(PyObject value, int start, int stop)

pack-priv static final PyObject
tuple_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

protected String
unsupportedopMessage(String op, PyObject o2)

Overrides org.python.core.PySequence.unsupportedopMessage.

Return sequence-specific error messages suitable for substitution.