Trying to create a custom array structure. Ideally I would like to
subclass the built in list, but it seems this feature won't be
available till version 2.2 (as per CPython) so instead I am extending
java.util.ArrayList as per below. This works fine, and I can access the
object using standard array syntax (x .. etc). However when I look
under the hood / overload some of the built in methods, it appears they
are different from CPython. In particular, __repr__ gets called as
expected but __getitem__ does not (see below). (If I run the code in
CPython 2,2, replacing ArrayList with list, it works as expected).
Perhaps someone can shed some light on what is happening here.
from java.util import *
for i in self:
print r # successfully calls __repr__
print r # returns the right result, but doens't call
Get latest updates about Open Source Projects, Conferences and News.