From: Anthony S. <A.J...@su...> - 2009-06-04 12:55:37
|
Hi all, 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)? __finditem__(...)? (I think __iter__ is a Python 2.2 innovation, so I guess that's not involved in Jython 2.1?) Thanks! Anthony |