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

Negative index handling #6

Closed
Technologicat opened this issue Jul 25, 2019 · 0 comments
Closed

Negative index handling #6

Technologicat opened this issue Jul 25, 2019 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Technologicat
Copy link
Owner

Make sure unpythonic handles negative indices the same way as standard Python.

Most of the code should already be correct, but particularly, at least in the unpythonic.collections module (see _make_negidx_converter), I've accidentally modded by the length instead of just adding the length once when it gets a negative index.

(This may well be the only place that needs fixing. Probably still a good idea to grep for the % operator in all of the codebase.)

The current behavior may hide some IndexErrors in user code (e.g. trying to access lst[-8] when len(lst) == 5), and should be considered a bug.

@Technologicat Technologicat added the bug Something isn't working label Jul 25, 2019
@Technologicat Technologicat added this to the 0.14.2 milestone Aug 8, 2019
@Technologicat Technologicat self-assigned this Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant