I'm trying to adapt a Java class so that "for" loops run smoothly in
Jython 2.1, but I'm getting confused.
At the moment I'm overriding __getitem__(int), which the API says I
shouldn't do, and it's giving a java.lang.IndexOutOfBoundsException
after looping over the items.
Could someone point me to a simple explanation of what happens when a
"for" loop is called?
for a in b:
Which methods are invoked and in which order? __getitem__(PyObject)?
(I think __iter__ is a Python 2.2 innovation, so I guess that's not
involved in Jython 2.1?)