Is it OK to subclass memoryview?
Posted: Sat Sep 21, 2019 2:04 am
CPython doesn't allow subclassing memoryview:
but MicroPython does:
I'm curious if anybody knows:
1. The reason why this was allowed in MicroPython but not in CPython? (I'm actually not sure why this is disallowed in CPython)
2. Are there any "gotchas" or things to be aware of when subclassing memoryview in MicroPython?
Code: Select all
>>> class MyMV(memoryview):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type 'memoryview' is not an acceptable base type
Code: Select all
>>> class MyMV(memoryview):
... pass
>>>
1. The reason why this was allowed in MicroPython but not in CPython? (I'm actually not sure why this is disallowed in CPython)
2. Are there any "gotchas" or things to be aware of when subclassing memoryview in MicroPython?