-
-
Notifications
You must be signed in to change notification settings - Fork 656
Open
Description
On Python 2 something like this works:
Sequence([range(10)])
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.
Component: python3
Issue created by migration from https://trac.sagemath.org/ticket/24543