Message170482
0-dim memory is indexed by x[()]. The ctypes example has an additional
problem, because format="<d" is not yet implemented in memoryview.
Only native single character formats in struct module syntax are
implemented, and "<d" in struct module syntax means "standard size,
little endian".
To demonstrate 0-dim indexing, here's an example using _testbuffer:
>>> x = ndarray(3.14, shape=[], format='d', flags=ND_WRITABLE)
>>> x[()]
3.14
>>> tau = 6.28
>>> x[()] = tau
>>> x[()]
6.28
>>> m = memoryview(x)
>>> m[()]
6.28
>>> m[()] = 100.111
>>> m[()]
100.111 |
|
Date |
User |
Action |
Args |
2012-09-14 16:01:23 | skrah | set | recipients:
+ skrah, pitrou, dabeaz |
2012-09-14 16:01:23 | skrah | set | messageid: <1347638483.64.0.949152972898.issue15944@psf.upfronthosting.co.za> |
2012-09-14 16:01:23 | skrah | link | issue15944 messages |
2012-09-14 16:01:22 | skrah | create | |
|