[Python-ideas] Should range() == range(0)?
Antoine Pitrou
solipsis at pitrou.net
Mon May 7 19:06:12 CEST 2012
On Mon, 07 May 2012 13:04:17 -0400
Terry Reedy <tjreedy at udel.edu> wrote:
> On 5/7/2012 7:14 AM, Nick Coghlan wrote:
> > On Mon, May 7, 2012 at 8:50 PM, Georg Brandl<g.brandl at gmx.net> wrote:
> >> For what gain? At the moment, I cannot think of any arguments in favor
> >> of the change, which is the point where arguments against it aren't
> >> even needed to keep the status quo.
> >>
> >> Ah yes: and I would rather have the bug
> >>
> >> for i in range(): #<- "n" (or equivalent) missing
> >>
> >> give me an explicit exception than silently "skipping" the loop.
> >> After all, the primary use case for range() is loops, and we should not
> >> make that use worse for the benefit of hypothetical other use cases.
> >
> > Now *that's* a good reason to nix the idea :)
>
> I agree that the bug possibility is by far the strongest for range
> whereas the usefulness is probably the weakest. So this seems a case of
> practicality beats purity.
The fact that there's absolutely no use case to call range() without an
argument is enough to dismiss the idea, IMO.
Just because something can be done doesn't mean it should be done.
Regards
Antoine.
More information about the Python-ideas
mailing list