org.python.core

Class PyList

public class PyList extends PySequenceList

A builtin python list.
Field Summary
static Classexposed_base
static Stringexposed_name
Constructor Summary
PyList()
PyList(PyType type)
PyList(PyType type, PyObject[] elements)
PyList(PyType type, Collection c)
PyList(Vector v)
PyList(PyObject[] elements)
PyList(PyObject o)
Method Summary
voidappend(PyObject o)
Add a single element to the end of list.
static voidclassDictInit(PyObject dict)
intcount(PyObject o)
Return the number elements in the list that equals the argument.
voidextend(PyObject o)
Append the elements in the argument sequence to the end of the list.
inthashCode()
intindex(PyObject o)
return smallest index where an element in the list equals the argument.
intindex(PyObject o, int start)
intindex(PyObject o, int start, int stop)
voidinsert(int index, PyObject o)
Insert the argument element into the list at the specified index.
PyObjectpop()
Removes and return the last element in the list.
PyObjectpop(int n)
Removes and return the n indexed element in the list.
voidremove(PyObject o)
Remove the first occurence of the argument from the list.
voidreverse()
Reverses the items of s in place.
StringsafeRepr()
voidsort(PyObject compare)
Sort the items of the list in place.
voidsort()
Sort the items of the list in place.
StringtoString()
static voidtypeSetup(PyObject dict, PyType.Newstyle marker)
PyObject__add__(PyObject o)
PyTuple__getnewargs__()
PyObject__iadd__(PyObject o)
PyObject__imul__(PyObject o)
int__len__()
PyObject__radd__(PyObject o)
PyObject__reduce__()
Used for pickling.

Field Detail

exposed_base

public static final Class exposed_base

exposed_name

public static final String exposed_name

Constructor Detail

PyList

public PyList()

PyList

public PyList(PyType type)

PyList

public PyList(PyType type, PyObject[] elements)

PyList

public PyList(PyType type, Collection c)

PyList

public PyList(Vector v)

PyList

public PyList(PyObject[] elements)

PyList

public PyList(PyObject o)

Method Detail

append

public void append(PyObject o)
Add a single element to the end of list.

Parameters: o the element to add.

classDictInit

public static void classDictInit(PyObject dict)

count

public int count(PyObject o)
Return the number elements in the list that equals the argument.

Parameters: o the argument to test for. Testing is done with the == operator.

extend

public void extend(PyObject o)
Append the elements in the argument sequence to the end of the list.
Same as s[len(s):len(s)] = o.

Parameters: o the sequence of items to append to the list.

hashCode

public int hashCode()

index

public int index(PyObject o)
return smallest index where an element in the list equals the argument.

Parameters: o the argument to test for. Testing is done with the == operator.

index

public int index(PyObject o, int start)

index

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

insert

public void insert(int index, PyObject o)
Insert the argument element into the list at the specified index.
Same as s[index:index] = [o] if index >= 0.

Parameters: index the position where the element will be inserted. o the element to insert.

pop

public PyObject pop()
Removes and return the last element in the list.

pop

public PyObject pop(int n)
Removes and return the n indexed element in the list.

Parameters: n the index of the element to remove and return.

remove

public void remove(PyObject o)
Remove the first occurence of the argument from the list. The elements arecompared with the == operator.
Same as del s[s.index(x)]

Parameters: o the element to search for and remove.

reverse

public void reverse()
Reverses the items of s in place. The reverse() methods modify the list in place for economy of space when reversing a large list. It doesn't return the reversed list to remind you of this side effect.

safeRepr

public String safeRepr()

sort

public void sort(PyObject compare)
Sort the items of the list in place. The compare argument is a function of two arguments (list items) which should return -1, 0 or 1 depending on whether the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process down considerably; e.g. to sort a list in reverse order it is much faster to use calls to the methods sort() and reverse() than to use the built-in function sort() with a comparison function that reverses the ordering of the elements.

Parameters: compare the comparison function.

sort

public void sort()
Sort the items of the list in place. Items is compared with the normal relative comparison operators.

toString

public String toString()

typeSetup

public static void typeSetup(PyObject dict, PyType.Newstyle marker)

__add__

public PyObject __add__(PyObject o)

__getnewargs__

public PyTuple __getnewargs__()

__iadd__

public PyObject __iadd__(PyObject o)

__imul__

public PyObject __imul__(PyObject o)

__len__

public int __len__()

__radd__

public PyObject __radd__(PyObject o)

__reduce__

public PyObject __reduce__()
Used for pickling.

Returns: a tuple of (class, tuple)