MCPcopy Index your code
hub / github.com/numpy/numpy / __str__

Method __str__

numpy/_core/tests/test_arrayprint.py:123–128  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

121 return {0: 'zero', 1: 'one', 2: 'two'}.get(self.item(), 'many')
122
123 def __str__(self):
124 if self.shape == ():
125 return self.to_string()
126 else:
127 fmt = {'all': lambda x: x.to_string()}
128 return np.array2string(self, formatter=fmt)
129
130 dc = np.arange(5).view(DuckCounter)
131 assert_equal(str(dc), "[zero one two many many]")

Callers

nothing calls this directly

Calls 1

to_stringMethod · 0.95

Tested by

no test coverage detected