pyon: use dtype.str

* contains endianess, makes this portable
* it's shorter
* it's what the numpy array interfaces uses
* this is otherwise backwards and forwards compatible
This commit is contained in:
Robert Jördens 2016-05-21 18:57:44 +02:00
parent 3d6f55104b
commit a9434d2e9f

View File

@ -140,14 +140,14 @@ class _Encoder:
def encode_nparray(self, x):
r = "nparray("
r += self.encode(x.shape) + ", "
r += self.encode(str(x.dtype)) + ", "
r += self.encode(x.dtype.str) + ", "
r += self.encode(base64.b64encode(x).decode())
r += ")"
return r
def encode_npscalar(self, x):
r = "npscalar("
r += "\"" + type(x).__name__ + "\", "
r += self.encode(x.dtype.str) + ", "
r += self.encode(base64.b64encode(x).decode())
r += ")"
return r