提交 78fdbd22 authored 作者: James Bergstra's avatar James Bergstra

clarified typeerror message in scalar.filter

上级 ee786d56
......@@ -61,7 +61,9 @@ class Scalar(Type):
def filter(self, data, strict = False):
py_type = self.dtype_specs()[0]
if strict and not isinstance(data, py_type):
raise TypeError("%s expected a %s" % (self, self.dtype), data)
raise TypeError("%s expected a %s, got %s of type %s" % (self, py_type, data,
type(data)),
data)
try:
return py_type(data)
except Exception, e:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论