Author Eric Wieser
Recipients Eric Wieser, skrah
Date 2020-02-11.15:42:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Right now, the behavior is:

>>> import numpy as np
>>> arr_0d = np.array(42)
>>> mem_0d = memoryview(arr_0d)
>>> len(mem_0d)
>>> mem_0d[0]
TypeError: invalid indexing of 0-dim memory

It seems bizarre to have this object pretend to be a sequence when you ask for its length, yet not behave like one when you actually try to use this length. I'd suggest cpython should behave like numpy here, and fail:

>>> len(arr_0d)
TypeError: len() of unsized object

Perhaps `TypeError: cannot get length of 0-dim memory` would be more appropriate as a message.


Wasn't sure how to classify this, feel free to reclassify
Date User Action Args
2020-02-11 15:42:52Eric Wiesersetrecipients: + Eric Wieser, skrah
2020-02-11 15:42:52Eric Wiesersetmessageid: <>
2020-02-11 15:42:52Eric Wieserlinkissue39610 messages
2020-02-11 15:42:52Eric Wiesercreate