提交 8015719a authored 作者: Ian Goodfellow's avatar Ian Goodfellow

better error message

上级 a0d35681
...@@ -95,7 +95,9 @@ else: ...@@ -95,7 +95,9 @@ else:
def update(self, container): def update(self, container):
# only allowed ordered containers # only allowed ordered containers
assert isinstance(container, (list, OrderedSet)) if not isinstance(container, (list, tuple, OrderedSet)):
raise TypeError("OrderedSet can only be ordered if updated "
" with ordered containers. Got "+str(type(container)))
for elem in container: for elem in container:
self.add(elem) self.add(elem)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论