@@ -84,6 +84,8 @@ public static void classDictInit(PyObject dict) {
8484 dict .__setitem__ ("__doc__" , __doc__ );
8585 dict .__setitem__ ("chain" , chain .TYPE );
8686 dict .__setitem__ ("imap" , imap .TYPE );
87+ dict .__setitem__ ("ifilter" , ifilter .TYPE );
88+ dict .__setitem__ ("izip" , izip .TYPE );
8789
8890 // Hide from Python
8991 dict .__setitem__ ("classDictInit" , null );
@@ -365,20 +367,6 @@ public PyObject __iternext__() {
365367 }
366368 }
367369
368- public static PyString __doc__ifilter = new PyString (
369- "ifilter(function or None, sequence) --> ifilter object\n \n "
370- + "Return those items of sequence for which function(item) is true.\n If function is None, "
371- + "return the items that are true." );
372-
373- /**
374- * Creates an iterator that returns the items of the iterable for which
375- * <code>predicate(item)</code> is <code>true</code>. If <code>predicate</code> is null
376- * (None) return the items that are true.
377- */
378- public static PyIterator ifilter (PyObject predicate , PyObject iterable ) {
379- return new FilterIterator (predicate , iterable , true );
380- }
381-
382370 public static PyString __doc__ifilterfalse = new PyString (
383371 "'ifilterfalse(function or None, sequence) --> ifilterfalse object\n \n "
384372 + "Return those items of sequence for which function(item) is false.\n If function is None, "
@@ -393,63 +381,6 @@ public static PyIterator ifilterfalse(PyObject predicate, PyObject iterable) {
393381 return new FilterIterator (predicate , iterable , false );
394382 }
395383
396- public static PyString __doc__izip = new PyString (
397- "izip(iter1 [,iter2 [...]]) --> izip object\n \n Return an izip object "
398- + "whose .next() method returns a tuple where\n the i-th element comes from the i-th iterable argument. "
399- + "The .next()\n method continues until the shortest iterable in the argument sequence\n is exhausted and then it "
400- + "raises StopIteration. Works like the zip()\n function but consumes less memory by returning an iterator "
401- + "instead of\n a list." );
402-
403- /**
404- * Create an iterator whose <code>next()</code> method returns a tuple where the i-th element
405- * comes from the i-th iterable argument. Continues until the shortest iterable is exhausted.
406- * (Code in this method is based on __builtin__.zip()).
407- *
408- */
409- public static PyIterator izip (PyObject [] argstar ) {
410- final int itemsize = argstar .length ;
411-
412- if (itemsize == 0 ) {
413- return (PyIterator )(new PyXRange (0 ).__iter__ ());
414- }
415-
416- // Type check the arguments; they must be sequences.
417- final PyObject [] iters = new PyObject [itemsize ];
418-
419- for (int i = 0 ; i < itemsize ; i ++) {
420- PyObject iter = argstar [i ].__iter__ ();
421- if (iter == null ) {
422- throw Py .TypeError ("izip argument #" + (i + 1 )
423- + " must support iteration" );
424- }
425- iters [i ] = iter ;
426- }
427-
428- return new ItertoolsIterator () {
429-
430- public PyObject __iternext__ () {
431- if (itemsize == 0 )
432- return null ;
433-
434- PyObject [] next = new PyObject [itemsize ];
435- PyObject item ;
436-
437- for (int i = 0 ; i < itemsize ; i ++) {
438-
439- item = nextElement (iters [i ]);
440-
441- if (item == null ) {
442- return null ;
443- }
444- next [i ] = item ;
445- }
446- return new PyTuple (next );
447- }
448-
449- };
450-
451- }
452-
453384 public static PyString __doc__starmap = new PyString (
454385 "starmap(function, sequence) --> starmap object\n \n Return an "
455386 + "iterator whose values are returned from the function evaluated\n with an argument tuple taken from the "
0 commit comments