-
Notifications
You must be signed in to change notification settings - Fork 13.5k
(RFC) remove the Times trait in favour of range
#8371
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
Conversation
I don't see how to special case the for loop syntax. It has to decide whether to parse the tokens after "for" as pattern or expr. How should it choose? |
That's true, it's not as simple as I expected due to the need to avoid boundless lookahead. I guess that's the cost of putting the pattern first. Whether or not we can make a short form, I still think we should be using |
I've already registered my arguments against this in the comments on #8326. To reiterate the most important points:
Even before external iterators we'd had the ability to do
To repeat, I'm fine with removing all uses of |
This is a tough call for me. My gut tells me to not like With If we do keep it, then I think it should stay in the prelude - as a convenience method it's much less convenient to require an import. |
I find it less convenient, because you have no An alternative is |
I doubt that I've ever tried to break out of or return from |
The Every single function/method/trait/type in the library is a burden, because it makes the language more complex. I don't think |
It's not possible to break from `times` and it results in the restrictions coming from closures. Using `for _ in range(0, n)` from the start is simpler, rather than switching to it after hitting either of these issues.
I want to solicit other opinions. |
Can |
If we made a trait for unsigned integers, it could be implemented from that. |
What about dropping the trait and just having |
Closing due to lack of activity. Feel free to open a new pull request if consensus gets reached on this! |
It's not possible to break from
times
and it results in therestrictions coming from closures. Using
for _ in range(0, n)
from thestart is simpler, rather than switching to it after hitting either of
these issues.