Arithmetic sequences in Python

Xavier Morel xavier.morel at masklinn.net
Mon Jan 16 17:44:21 CET 2006


Steven D'Aprano wrote:
> On Mon, 16 Jan 2006 12:51:58 +0100, Xavier Morel wrote:
> 
>> For those who'd need the (0..n-1) behavior, Ruby features something that 
>> I find quite elegant (if not perfectly obvious at first), (first..last) 
>> provides a range from first to last with both boundaries included, but 
>> (first...last) (notice the 3 periods) 
> 
> No, no I didn't.
> 
> Sheesh, that just *screams* "Off By One Errors!!!". Python deliberately
> uses a simple, consistent system of indexing from the start to one past
> the end specifically to help prevent signpost errors, and now some folks
> want to undermine that.
> 
> *shakes head in amazement*
> 
> 
Steven, I never said that Python should use this syntax, I merely showed 
how it was done in Ruby.

It's nothing more than a ... basis of discussion... not a "I want that 
!!ONE" post (if I did, i'd be using Ruby and posting on c.l.r)

(and you didn't what by the way?)

Ok scratch that, you didn't notice the 3 periods.



More information about the Python-list mailing list