Message204613
| Author |
hct |
| Recipients |
hct, skrah |
| Date |
2013年11月27日.21:09:44 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1385586585.33.0.640639870537.issue19803@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
this seems to disagree with the statement of "Memoryview currently only knows the types from the struct module."
why is memoryview aware of _pack_, a implementation detail of ctypes structures. is memoryview a collection of implementation for different types or a unique type on its own?
>>> import ctypes
>>> class B1(ctypes.Structure):
... _fields_ = [( "data", c_uint8 * 256 ), ]
... _pack_ = 1
...
>>> class B2(ctypes.Structure):
... _fields_ = [( "data", c_uint8 * 256 ), ]
...
>>>
>>> a = B1()
>>> b = B2()
>>> memoryview( a ).cast( 'B' )
<memory at 0x01FFCDC0>
>>> memoryview( b ).cast( 'B' )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: memoryview: source format must be a native single character format prefixed with an optional '@'
>>> |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年11月27日 21:09:45 | hct | set | recipients:
+ hct, skrah |
| 2013年11月27日 21:09:45 | hct | set | messageid: <1385586585.33.0.640639870537.issue19803@psf.upfronthosting.co.za> |
| 2013年11月27日 21:09:45 | hct | link | issue19803 messages |
| 2013年11月27日 21:09:44 | hct | create |
|