[Python-Dev] range objects in 3.x

Ethan Furman ethan at stoneleaf.us
Tue Sep 27 19:32:13 CEST 2011


Guido van Rossum wrote:
> On Tue, Sep 27, 2011 at 10:11 AM, Alexander Belopolsky wrote:
>> The name "frange" does not necessarily imply that we have to mimic the
>> API completely.  As long as frange(10.0) and frange(1.0, 10.0) works
>> as expected while addressing floating point subtleties through
>> optional arguments and documentation, I don't see why it can't be
>> called frange() *and* support count.
> 
> But I do. :-) Calling it frange() is pretty much *begging* people to
> assume that the 3rd parameter has the same meaning as for range().
> Now, there are a few cases where that doesn't matter, e.g. frange(0,
> 100, 10) will do the expected thing under both interpretations, but
> frange(0, 100, 5) will not.


What about the idea of this signature?

frange([start], stop, step=None, count=None)

Then when count is desired, it can be specified, and when step is 
sufficient, no change is necessary.

~Ethan~


More information about the Python-Dev mailing list