Arithmetic sequences in Python

Steven D'Aprano steve at REMOVETHIScyber.com.au
Mon Jan 16 11:14:08 EST 2006


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.




More information about the Python-list mailing list