What's better about Ruby than Python?
Alex Martelli
aleaxit at yahoo.com
Tue Aug 19 06:36:02 EDT 2003
Asun Friere wrote:
...
> Ah yes, back to substance. I forgot to mention that Ruby ranges seem
> much more intuitive than Python slicing. But I think the confusion,
Having both a..b AND a...b -- one indicating a half-open range, another
indicating a closed range -- "more intuitive"? You gotta be kidding...
> to the extent that confusion does exist, is because Python has one
> foot in the C-like 'n-1 indexed array' camp (in relation to ordinary
> indexing of elements), and one in the '0 is not an ordinal, but a
> point of origin,' camp (in relation to splitting). :ducks.
Python's firmly in the "always half-open" field (pioneered in print,
to the best of my knowledge, in A. Koenig's "C Traps and Pitfalls",
and -- no doubt partly thanks to Koenig's influence -- pervasive in
the C++ standard library too). Not sure where _splitting_ enters
the picture -- you mean, e.g., 'a few words'.split()? What's THAT
gotta do with intervals, or slices?
Alex
More information about the Python-list
mailing list