use of org.cafebabepy.runtime.object.iterator.PyRangeIteratorObject in project cafebabepy by cafebabepy.
the class PyRangeType method __iter__.
@DefinePyFunction(name = __iter__)
public PyObject __iter__(PyObject self) {
if (!this.runtime.isInstance(self, this)) {
throw this.runtime.newRaiseTypeError("descriptor '__iter__' requires a 'range' object but received a '" + self.getType().getFullName() + "'");
}
PyObject start = this.runtime.getattr(self, "start");
PyObject stop = this.runtime.getattr(self, "stop");
PyObject step = this.runtime.getattr(self, "step");
int startInt = ((PyIntObject) start).getIntValue();
int stopInt = ((PyIntObject) stop).getIntValue();
int stepInt = ((PyIntObject) step).getIntValue();
return new PyRangeIteratorObject(this.runtime, startInt, stopInt, stepInt);
}
Aggregations