|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.python.modules.itertools
public class itertools
Functional tools for creating and using iterators. Java implementation of the CPython module itertools.
Field Summary | |
---|---|
static PyString |
__doc__
|
static PyString |
__doc__chain
|
static PyString |
__doc__count
|
static PyString |
__doc__cycle
|
static PyString |
__doc__dropwhile
|
static PyString |
__doc__groupby
|
static PyString |
__doc__ifilter
|
static PyString |
__doc__ifilterfalse
|
static PyString |
__doc__imap
|
static PyString |
__doc__islice
|
static PyString |
__doc__izip
|
static PyString |
__doc__repeat
|
static PyString |
__doc__starmap
|
static PyString |
__doc__takewhile
|
static PyString |
__doc__tee
|
Constructor Summary | |
---|---|
itertools()
|
Method Summary | |
---|---|
static PyIterator |
chain(PyObject[] iterables)
Creates an iterator that iterates over a chain of iterables. |
static void |
classDictInit(PyObject dict)
|
static PyIterator |
count()
Creates an iterator that returns consecutive integers starting at 0. |
static PyIterator |
count(int init)
Creates an iterator that returns consecutive integers starting at init . |
static PyIterator |
cycle(PyObject sequence)
Returns an iterator that iterates over an iterable, saving the values for each iteration. |
static PyIterator |
dropwhile(PyObject predicate,
PyObject iterable)
Create an iterator that drops items from the iterable while prdicate(item)
equals true. |
static PyIterator |
groupby(PyObject[] args,
String[] kws)
Create an iterator which returns the pair (key, sub-iterator) grouped by key(value). |
static PyIterator |
ifilter(PyObject predicate,
PyObject iterable)
Creates an iterator that returns the items of the iterable for which predicate(item) is true . |
static PyIterator |
ifilterfalse(PyObject predicate,
PyObject iterable)
Creates an iterator that returns the items of the iterable for which predicate(item) is false . |
static PyIterator |
imap(PyObject[] argstar)
Works as __builtin__.map() but returns an iterator instead of a list. |
static PyIterator |
islice(PyObject iterable,
PyObject stopObj)
|
static PyIterator |
islice(PyObject iterable,
PyObject start,
PyObject stopObj)
|
static PyIterator |
islice(PyObject iterable,
PyObject startObj,
PyObject stopObj,
PyObject stepObj)
Creates an iterator that returns selected values from an iterable. |
static PyIterator |
izip(PyObject[] argstar)
Create an iterator whose next() method returns a tuple where the i-th element
comes from the i-th iterable argument. |
static PyIterator |
repeat(PyObject object)
Creates an iterator that returns the same object over and over again. |
static PyIterator |
repeat(PyObject object,
int times)
Creates an iterator that returns the same object the number of times given by times . |
static PyIterator |
starmap(PyObject[] starargs)
Create an iterator whose next() method returns the result
of calling the function (first argument) with a tuple of arguments
returned from the iterable (second argument). |
static PyIterator |
takewhile(PyObject predicate,
PyObject iterable)
Create an iterator that returns items from the iterable while predicate(item)
is true. |
static PyTuple |
tee(PyObject iterable)
Create a pair of iterators, each of which is effectively a copy of iterable. |
static PyTuple |
tee(PyObject iterable,
int n)
Create a tuple of iterators, each of which is effectively a copy of iterable. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static PyString __doc__
public static PyString __doc__count
public static PyString __doc__cycle
public static PyString __doc__chain
public static PyString __doc__repeat
public static PyString __doc__imap
public static PyString __doc__islice
public static PyString __doc__ifilter
public static PyString __doc__ifilterfalse
public static PyString __doc__izip
public static PyString __doc__starmap
public static PyString __doc__dropwhile
public static PyString __doc__takewhile
public static PyString __doc__groupby
public static PyString __doc__tee
Constructor Detail |
---|
public itertools()
Method Detail |
---|
public static void classDictInit(PyObject dict)
public static PyIterator count(int init)
init
.
public static PyIterator count()
public static PyIterator cycle(PyObject sequence)
public static PyIterator chain(PyObject[] iterables)
public static PyIterator repeat(PyObject object, int times)
times
.
public static PyIterator repeat(PyObject object)
public static PyIterator imap(PyObject[] argstar)
__builtin__.map()
but returns an iterator instead of a list. (Code in
this method is based on __builtin__.map()).
public static PyIterator islice(PyObject iterable, PyObject startObj, PyObject stopObj, PyObject stepObj)
startObj
- the index of where in the iterable to start returning valuesstopObj
- the index of where in the iterable to stop returning valuesstepObj
- the number of steps to take beween each call to next()
public static PyIterator islice(PyObject iterable, PyObject stopObj)
startObj defaults to 0 and stepObj to 1
public static PyIterator islice(PyObject iterable, PyObject start, PyObject stopObj)
stepObj defaults to 1
public static PyIterator ifilter(PyObject predicate, PyObject iterable)
predicate(item)
is true
. If predicate
is null
(None) return the items that are true.
public static PyIterator ifilterfalse(PyObject predicate, PyObject iterable)
predicate(item)
is false
. If predicate
is null
(None) return the items that are false.
public static PyIterator izip(PyObject[] argstar)
next()
method returns a tuple where the i-th element
comes from the i-th iterable argument. Continues until the shortest iterable is exhausted.
(Code in this method is based on __builtin__.zip()).
public static PyIterator starmap(PyObject[] starargs)
next()
method returns the result
of calling the function (first argument) with a tuple of arguments
returned from the iterable (second argument).
starargs
- [0] = callable function, [1] = iterable with argument tuplespublic static PyIterator dropwhile(PyObject predicate, PyObject iterable)
prdicate(item)
equals true. After which every remaining item of the iterable is returned.
public static PyIterator takewhile(PyObject predicate, PyObject iterable)
predicate(item)
is true. After which iteration is stopped.
public static PyIterator groupby(PyObject[] args, String[] kws)
public static PyTuple tee(PyObject iterable, int n)
public static PyTuple tee(PyObject iterable)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |