You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
naturally, since range(10) just returns a list. On Python 3 however, since range is a type:
sage: Sequence([range(10)])
Traceback
...
TypeError: 'range' object cannot be interpreted as an integer
...
TypeError: unable to convert range(0, 10) to an element of <class 'range'>
This is because the Sequence constructor determines the "universe" of the sequence to be range, and later tries to pass range objects to range like: universe(x[i]) where x[i] is the range(10) instance.
It assumes that whatever universe is can construct an instance of itself by being passed a single argument. One could argue that Python's range() built-in should support this as a special case. But regardless this should be fixed in Sage. I'm just not sure the best way yet.
On Python 2 something like this works:
naturally, since
range(10)
just returns alist
. On Python 3 however, sincerange
is a type:This is because the
Sequence
constructor determines the "universe" of the sequence to berange
, and later tries to passrange
objects torange
like:universe(x[i])
wherex[i]
is therange(10)
instance.It assumes that whatever
universe
is can construct an instance of itself by being passed a single argument. One could argue that Python'srange()
built-in should support this as a special case. But regardless this should be fixed in Sage. I'm just not sure the best way yet.Component: python3
Issue created by migration from https://trac.sagemath.org/ticket/24543
The text was updated successfully, but these errors were encountered: