Message5438
>>> from jarray import array
>>> from java.lang import Object
>>> x = array([0,1,2], Object)
>>> x.append(3)
>>> x
array(java.lang.Object, [0, 1, 2, 3])
>>> y = array([x], Object)
>>> y
array(java.lang.Object, [array(java.lang.Object, [0, 1, 2, 3, None, None, None])])
>>> x == y[0]
False
The append on x causes some extra array space to be allocated, but apparently the end of the array isn't remembered when assigned into y. However, if we use PyObject instead of Object...
>>> x = array([0,1,2], object)
>>> x.append(3)
>>> x
array(org.python.core.PyObject, [0, 1, 2, 3])
>>> y = array([x], object)
>>> y
array(org.python.core.PyObject, [array(org.python.core.PyObject, [0, 1, 2, 3])])
>>> x == y[0]
True
In case it matters:
$ java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode) |
|
Date |
User |
Action |
Args |
2010-01-14 19:05:00 | kwatford | set | recipients:
+ kwatford |
2010-01-14 19:04:59 | kwatford | set | messageid: <1263495899.77.0.551478071392.issue1543@psf.upfronthosting.co.za> |
2010-01-14 19:04:58 | kwatford | link | issue1543 messages |
2010-01-14 19:04:57 | kwatford | create | |
|