KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > core > PySequenceIter


1 package org.python.core;
2
3 public class PySequenceIter extends PyIterator {
4     private PyObject seq;
5     private int idx;
6
7     public PySequenceIter(PyObject seq) {
8         this.seq = seq;
9         this.idx = 0;
10     }
11
12     public PyObject __iternext__() {
13         try {
14             return seq.__finditem__(idx++);
15         } catch (PyException exc) {
16             if (Py.matchException(exc, Py.StopIteration))
17                 return null;
18             throw exc;
19         }
20     }
21
22 }
23
24
Popular Tags