mirror of
https://github.com/micropython/micropython.git
synced 2025-09-06 01:40:34 +02:00
This allows figuring out the number of bytes in the memoryview object as len(memview) * memview.itemsize. The feature is enabled via MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE and is disabled by default.
10 lines
204 B
Python
10 lines
204 B
Python
try:
|
|
memoryview(b'a').itemsize
|
|
from array import array
|
|
except:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
for code in ['b', 'h', 'i', 'l', 'q', 'f', 'd']:
|
|
print(memoryview(array(code)).itemsize)
|