提交 b86dd2d6 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

assert that both flags are not true

上级 7ffcc89b
...@@ -33,6 +33,8 @@ def format_as(use_list, use_tuple, outputs): ...@@ -33,6 +33,8 @@ def format_as(use_list, use_tuple, outputs):
is not a list or a tuple then it is converted into a one element tuple) is not a list or a tuple then it is converted into a one element tuple)
Otherwise (if both flags are false), `outputs` is returned. Otherwise (if both flags are false), `outputs` is returned.
""" """
assert not (use_list and use_tuple), \
"Both flags can not be simultaneously True"
if (use_list or use_tuple) and not isinstance(outputs, (list, tuple)): if (use_list or use_tuple) and not isinstance(outputs, (list, tuple)):
if use_list: if use_list:
return [outputs] return [outputs]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论