Top Fields Constructors Methods
org.python.modules.itertools

public Class count

extends PyIterator
Class Inheritance
Known Direct Subclasses
org.python.modules.itertools.countDerived
Annotations
@ExposedType
name:itertools.count
base:PyObject
doc:count(start=0, step=1) --> count object Return a count object whose .next() method returns consecutive values. Equivalent to: def count(firstval=0, step=1): x = firstval while 1: yield x x += step
Imports
org.python.core.ArgParser, .Py, .PyException, .PyInteger, .PyIterator, .PyObject, .PyString, .PyTuple, .PyType, .__builtin__, .Visitproc, org.python.expose.ExposedNew, .ExposedMethod, .ExposedType

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
count(PyType subType)

public
count()

Creates an iterator that returns consecutive numbers starting at 0.

public
count(final PyObject start)

Creates an iterator that returns consecutive numbers starting at start.

public
count(final PyObject start, final PyObject step)

Creates an iterator that returns consecutive numbers starting at start with step step.

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
public PyString
__repr__()

Overrides org.python.core.PyObject.__repr__.

Equivalent to the standard Python __repr__ method.

public PyObject
pack-priv final void
count___init__(final PyObject[] args, String[] kwds)

private void
count___init__(final PyObject start, final PyObject step)

pack-priv final PyObject
pack-priv final PyObject
private static PyObject
private static synchronized PyObject
public PyObject
next()

Overrides org.python.core.PyIterator.next.

The exposed next method.

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

count_docback to summary
public static final String count_doc
counterback to summary
private PyObject counter
iterback to summary
private PyIterator iter
NumberClassback to summary
private static PyObject NumberClass
stepperback to summary
private PyObject stepper
TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

Constructor Detail

countback to summary
public count(PyType subType)
countback to summary
public count()

Creates an iterator that returns consecutive numbers starting at 0.

countback to summary
public count(final PyObject start)

Creates an iterator that returns consecutive numbers starting at start.

countback to summary
public count(final PyObject start, final PyObject step)

Creates an iterator that returns consecutive numbers starting at start with step step.

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.

__reduce_ex__back to summary
public PyObject __reduce_ex__(PyObject protocol)
__repr__back to summary
public PyString __repr__()

Overrides org.python.core.PyObject.__repr__.

Doc from org.python.core.PyObject.__repr__.

Equivalent to the standard Python __repr__ method. Each sub-class of PyObject is likely to re-define this method to provide for its own reproduction.

Annotations
@ExposedMethod
count___copy__back to summary
public PyObject count___copy__()
Annotations
@ExposedMethod
count___init__back to summary
pack-priv final void count___init__(final PyObject[] args, String[] kwds)
Annotations
@ExposedNew
@ExposedMethod
count___init__back to summary
private void count___init__(final PyObject start, final PyObject step)
count___reduce__back to summary
pack-priv final PyObject count___reduce__()
Annotations
@ExposedMethod
count___reduce_ex__back to summary
pack-priv final PyObject count___reduce_ex__(PyObject protocol)
Annotations
@ExposedMethod
getNumberback to summary
private static PyObject getNumber(PyObject obj)
getNumberClassback to summary
private static synchronized PyObject getNumberClass()
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

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