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

Stdlib: More range functions #791

Open
croyzor opened this issue Feb 3, 2025 · 0 comments
Open

Stdlib: More range functions #791

croyzor opened this issue Feb 3, 2025 · 0 comments

Comments

@croyzor
Copy link
Collaborator

croyzor commented Feb 3, 2025

It'd be nice to have the full spectrum of range functions available in python, e.g. range(min, max).
This is tricky because in guppy we don't support function overloading, so range always has one argument.

If we implement default arguments, we could consider range to have the signature:

range(max: int, min: int = 0, step: int = 1)

to do this without overloading.


It may be easier for guppy to reason about indices that come directly from a range iterator than the alternative, i.e.:

for i in range(3, len(xs)):
    f(xs[i])

vs

for i in range(len(xs)):
    f(xs[i + 3])

but maybe at this point it doesn't make a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant