Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/numpy/numpy
/ __new__
Method
__new__
numpy/core/tests/test_regression.py:1570–1571 ·
view source on GitHub ↗
(cls, i)
Source
from the content-addressed store, hash-verified
1568
# ticket #1563
1569
class
Subclass(np.ndarray):
1570
def
__new__(cls, i):
1571
return
np.ones((i,)).view(cls)
1572
1573
x = Subclass(5)
1574
x[(0,)] = 2
# shouldn't raise an exception
Callers
nothing calls this directly
Calls
1
view
Method · 0.45
Tested by
no test coverage detected