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

Method __str__

numpy/core/tests/test_arrayprint.py:112–117  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

110 return {0: 'zero', 1: 'one', 2: 'two'}.get(self.item(), 'many')
111
112 def __str__(self):
113 if self.shape == ():
114 return self.to_string()
115 else:
116 fmt = {'all': lambda x: x.to_string()}
117 return np.array2string(self, formatter=fmt)
118
119 dc = np.arange(5).view(DuckCounter)
120 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