Just stumbled over the following:
Python 3.6.0 (default, Jan 9 2017, 22:01:27)
[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>>
>>> np.version.version
'1.14.2'
>>>
>>> a = np.ones((100,), np.uint8)
>>> (a[:, None] == a).shape
(100, 100)
>>> a = np.ones((10000,), np.uint8)
>>> (a[:, None] == a).shape
(10000, 10000)
So far so expected, but now:
>>> a = np.ones((1000000,), np.uint8)
>>> (a[:, None] == a).shape
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'bool' object has no attribute 'shape'
In fact:
>>> a[:, None] == a
False
Can anyone reproduce this? Is it a bug or some kind of feature? If a feature is it documented somewhere?
Other operators just raise a memory error
>>> a[:, None] | a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError
which makes much more sense in my opinion.