Jython: where is itertools?

121 Views Asked by At

In Jython 2.5.3, trying to import itertools:

>>> from itertools import product
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name product

Yet if you see this page from Jython docs itertools looks a core part of Jython since 2.3.

What do I need on the syspath to import iterools?

1

There are 1 best solutions below

0
On BEST ANSWER

itertools.product is not available in Jython 2.5. The function was added in CPython 2.6, and is available in Jython 2.7.

See also https://wiki.python.org/jython/JythonFaq/GeneralInfo#Is_Jython_the_same_language_as_Python.3F.