Author skrah
Recipients dabeaz, pitrou, skrah
Date 2012-09-14.16:01:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347638483.64.0.949152972898.issue15944@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2012-09-14 16:01:23skrahsetrecipients: + skrah, pitrou, dabeaz
2012-09-14 16:01:23skrahsetmessageid: <1347638483.64.0.949152972898.issue15944@psf.upfronthosting.co.za>
2012-09-14 16:01:23skrahlinkissue15944 messages
2012-09-14 16:01:22skrahcreate