Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py3: need to fix sequence of ranges #24543

Open
embray opened this issue Jan 15, 2018 · 1 comment
Open

py3: need to fix sequence of ranges #24543

embray opened this issue Jan 15, 2018 · 1 comment

Comments

@embray
Copy link
Contributor

embray commented Jan 15, 2018

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

@embray embray added this to the sage-8.2 milestone Jan 15, 2018
@embray

This comment has been minimized.

@embray embray modified the milestones: sage-8.2, sage-8.3 Apr 26, 2018
@embray embray removed this from the sage-8.3 milestone Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant