MCPcopy Create free account
hub / github.com/numpy/numpy / OldSqueeze

Class OldSqueeze

numpy/core/tests/test_regression.py:1731–1746  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1729 # when squeezing
1730
1731 class OldSqueeze(np.ndarray):
1732
1733 def __new__(cls,
1734 input_array):
1735 obj = np.asarray(input_array).view(cls)
1736 return obj
1737
1738 # it is perfectly reasonable that prior
1739 # to numpy version 1.7.0 a subclass of ndarray
1740 # might have been created that did not expect
1741 # squeeze to have an axis argument
1742 # NOTE: this example is somewhat artificial;
1743 # it is designed to simulate an old API
1744 # expectation to guard against regression
1745 def squeeze(self):
1746 return super().squeeze()
1747
1748 oldsqueeze = OldSqueeze(np.array([[1],[2],[3]]))
1749

Callers 1

Calls

no outgoing calls

Tested by 1