On 07/02/2015 08:16 AM, Pierre Quentel wrote:
Again, this does not address the original problem : it produces the first 10 squares of 2, not the squares of 2 lower than a "stop" value.
The logic of range(start, stop, step) is to produce the integers starting at "start", incremented by "step", until the integer is >= "stop" (or <= stop if stop<start).
The other logic of range is to be able to say:
some_value in range(start, stop, step)
If step is an integer it is easy to calculate whether some_value is in the range; if step is a function, it becomes impossible to figure out without iterating through (possibly all) the values of range.
--
~Ethan~
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/