def __new__(cls, variable, value):
if not isinstance(variable, Variable):
raise TypeError("variable must be of type Variable")
_valid_instances = (Nil, Variable,
IndexedVariable, IndexedElement,
Tuple,
int, float, bool, complex, str,
Boolean, sp_Integer, sp_Float)
if not isinstance(value, _valid_instances):
raise TypeError('non-valid instance for value, '
'given {0}'.format(type(value)))
return Basic.__new__(cls, variable, value)
评论列表
文章目录