>>> arr = numpy.array(((2,2),(2,-2))) >>> tuple(map(tuple, arr)) ((2, 2), (2, -2))
def totuple(a): try: return tuple(totuple(i) for i in a) except TypeError: return a