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

Method __repr__

numpy/array_api/_array_object.py:102–113  ·  view source on GitHub ↗

Performs the operation __repr__.

(self: Array, /)

Source from the content-addressed store, hash-verified

100 return self._array.__str__().replace("array", "Array")
101
102 def __repr__(self: Array, /) -> str:
103 """
104 Performs the operation __repr__.
105 """
106 suffix = f", dtype={self.dtype.name})"
107 if 0 in self.shape:
108 prefix = "empty("
109 mid = str(self.shape)
110 else:
111 prefix = "Array("
112 mid = np.array2string(self._array, separator=', ', prefix=prefix, suffix=suffix)
113 return prefix + mid + suffix
114
115 # This function is not required by the spec, but we implement it here for
116 # convenience so that np.asarray(np.array_api.Array) will work.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected