Python integers ought to be iterables, like in set theory. So

for i in 10:
print(i)

prints 0 to 9.

@dpiponi I don't like the idea of integers themselves being iterable, but I do like the idea of a more concise range spelling. I particularly like the one that Lua and others use:

```
for i in 0..10: do_something()
```

And I could easily be convinced that the 0 could be omitted to give:

```
for i in ..10: do_something()
```

(although in reality this would probably never happen because of the confusability with Ellipsis, but a guy can dream…)

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.