크기 4의 랜덤 순열을 생성하기위한 목적으로 두 줄의 코드이다 :호환성 여기
TypeError Traceback (most recent call last)
<ipython-input-3-033ef4665637> in <module>()
1 from numpy import random
----> 2 t = random.permutation(Integer(4))
mtrand.pyx in mtrand.RandomState.permutation (numpy/random/mtrand/mtrand.c:34842)()
mtrand.pyx in mtrand.RandomState.shuffle (numpy/random/mtrand/mtrand.c:33796)()
TypeError: len() of unsized object
왜?
조금 더 자세히 : 나는 파이썬 3에서 코드를 실행했고, mtrand
도 파이썬 3 디렉토리에 있으며, 이는 sage가 numpy의 Python 2 버전을 호출 할 가능성을 배제해야한다.
그럼에도 불구하고 현재 사용중인 Sage는 Python 2 만 지원합니다 (가까운 장래에 변경 될 예정이지만 https://trac.sagemath.org/ticket/15530 참조). – kcrisman