On Sat, Jul 30, 2016 at 11:06 PM, Steven D'Aprano <st...@pearwood.info> wrote: >> "for i in range(N):" just to repeat a block N times... > > Why should there be special syntax just for repeating a block N times? > There's a general purpose for-loop which performs iteration. Why do you > need special syntax to do what it already does?
Python could have chosen to make integers iterable, such that you say: for i in 10: but I don't think it really improves readability. It wouldn't materially damage the language, though - the 'for' loop still does exactly what it does, the rules are still just as simple. The only question would be: why can't floats be iterable too? I mean, "for i in 3.5" should start half way down the loop body, complete that loop, and then do three complete loops. ChrisA -- https://mail.python.org/mailman/listinfo/python-list