Top Fields Constructors Methods
org.python.modules.itertools

public Class product

extends PyIterator
Class Inheritance
Known Direct Subclasses
org.python.modules.itertools.productDerived
Annotations
@ExposedType
name:itertools.product
base:PyObject
doc:product(*iterables) --> product object Cartesian product of input iterables. Equivalent to nested for-loops. For example, product(A, B) returns the same as: ((x,y) for x in A for y in B). The leftmost iterators are in the outermost for-loop, so the output tuples cycle in a manner similar to an odometer (with the rightmost element changing on every iteration). To compute the product of an iterable with itself, specify the number of repetitions with the optional repeat keyword argument. For example, product(A, repeat=4) means the same as product(A, A, A, A). product(\'ab\', range(3)) --> (\'a\',0) (\'a\',1) (\'a\',2) (\'b\',0) (\'b\',1) (\'b\',2) product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ...
Imports
org.python.core.Py, .PyIterator, .PyObject, .PyTuple, .PyType, .Visitproc, org.python.expose.ExposedMethod, .ExposedNew, .ExposedType

Field Summary

Modifier and TypeField and Description
private PyIterator
public static final String
public static final PyType
Inherited from org.python.core.PyIterator:
__doc__nextstopException

Constructor Summary

AccessConstructor and Description
public
public
product(PyType subType)

public
product(PyTuple[] tuples, int repeat)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__iternext__()

Implements abstract org.python.core.PyIterator.__iternext__.

Return the next element of the sequence that this is an iterator for.

public PyObject
next()

Overrides org.python.core.PyIterator.next.

The exposed next method.

pack-priv final void
private void
product___init__(PyTuple[] tuples, int repeat)

public boolean
public int
traverse(Visitproc visit, Object arg)

Overrides org.python.core.PyIterator.traverse.

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

Inherited from org.python.core.PyIterator:
__iter____tojava__doNextiterator

Field Detail

iterback to summary
private PyIterator iter
product_docback to summary
public static final String product_doc
TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

Constructor Detail

productback to summary
public product()
productback to summary
public product(PyType subType)
productback to summary
public product(PyTuple[] tuples, int repeat)

Method Detail

__iternext__back to summary
public PyObject __iternext__()

Implements abstract org.python.core.PyIterator.__iternext__.

Doc from org.python.core.PyObject.__iternext__.

Return the next element of the sequence that this is an iterator for. Returns null when the end of the sequence is reached.

nextback to summary
public PyObject next()

Overrides org.python.core.PyIterator.next.

Doc from org.python.core.PyIterator.next.

The exposed next method. Note that exposed derivable subclasses of PyIterator should override next to call doNext(custom___iternext__), as __iternext__ is overridden by the Derived classes.

Returns:PyObject

a PyObject result

Annotations
@ExposedMethod
@Override

product___init__back to summary
pack-priv final void product___init__(PyObject[] args, String[] kws)
Annotations
@ExposedNew
@ExposedMethod
product___init__back to summary
private void product___init__(PyTuple[] tuples, int repeat)
refersDirectlyToback to summary
public boolean refersDirectlyTo(PyObject ob)

Overrides org.python.core.PyIterator.refersDirectlyTo.

Implements org.python.core.Traverseproc.refersDirectlyTo.

Doc from org.python.core.Traverseproc.refersDirectlyTo.

Optional operation. Should only be implemented if it is more efficient than calling traverse(Visitproc, Object) with a visitproc that just watches out for ob. Must return false if ob is null.

Annotations
@Override
traverseback to summary
public int traverse(Visitproc visit, Object arg)

Overrides org.python.core.PyIterator.traverse.

Implements org.python.core.Traverseproc.traverse.

Doc from org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects. Like in CPython, arg must be passed unmodified to visit as its second parameter. If Visitproc#visit(PyObject, Object) returns nonzero, this return value must be returned immediately by traverse. Visitproc#visit(PyObject, Object) must not be called with a null PyObject-argument.

Annotations
@Override