|
RE: creating custom arrays / extending java.util.A rrayList: msg#00066lang.jython.user
Here is __getitem__ from org/python/core/PyInstance.java: public PyObject __getitem__(PyObject key) { CollectionProxy proxy = getCollection(); if (proxy != CollectionProxy.NoProxy) { PyObject ret = proxy.__finditem__(key); if (ret == null) { throw Py.KeyError(key.toString()); } return ret; } PyObject ret = trySlice(key, "__getslice__", null); if (ret != null) return ret; return invoke("__getitem__", key); } You can see that the code checks whether your instance is a collection first and calls its __finditem__ before calling your __getitem__ method. You might try extending org.python.core.PyList. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Executing a external script and setting the file system context, Anthony Tarlano |
|---|---|
| Next by Date: | RE: [Jython-users] creating custom arrays / extending java.util.A rrayList, Ype Kingma |
| Previous by Thread: | Executing a external script and setting the file system context, Anthony Tarlano |
| Next by Thread: | RE: [Jython-users] creating custom arrays / extending java.util.A rrayList, Ype Kingma |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |