For loops in Jython 2.1
2009-06-04 12:54:18 GMT
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 ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get(Continue reading)
RSS Feed