我的代码如下所示:
def Z(m,n):
return CartesianProduct(IntegerRange(m),IntegerRange(n))
for v in Subsets(Z(2,2)):
print v
但是,当我尝试运行它时,出现以下错误:
Traceback (most recent call last):
File "x.py", line 13, in <module>
for v in Subsets(Z(_sage_const_2 ,_sage_const_2 )):
File "/opt/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/combinat/subset.py", line 234, in __iter__
lset = __builtin__.list(self.s)
File "/opt/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/sets/set.py", line 650, in __iter__
for x in self.set():
File "/opt/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/sets/set.py", line 719, in set
return set(self.object())
TypeError: unhashable type: 'list'
获取任意集合的所有子集的集合的规范方法是什么?