if hasattr(x, 'list'):
# Easy case...
return x.list()
- if hasattr(x, 'cartesian_factors'):
- # If it's a formal cartesian product space element, then
- # we also know what to do...
- return sum(( x_i.list() for x_i in x ), [])
else:
- # But what if it's a tuple or something else?
+ # But what if it's a tuple or something else? This has to
+ # handle cartesian products of cartesian products, too; that's
+ # why it's recursive.
return sum( map(_all2list,x), [] )
def _mat2vec(m):