[Python-ideas] Reducing colon uses to increase readability

Leif Walsh leif.walsh at gmail.com
Tue Jul 1 00:04:39 CEST 2008


On Mon, Jun 30, 2008 at 3:00 PM, Andre Roberge <andre.roberge at gmail.com> wrote:
>> That said, I'm not sure 'arrows' are even the right approach for
>> slices.  Slices should be thought of as ranges, which usually lend
>> themselves to ellipses.  I remember (loosely, from a long time ago)
>> Ruby having '..' and '...' as exclusive and inclusive ranges, and I
>> really liked that.
>>
> [snip]
>>>
>>>  I have seen other alternatives for simple slices suggested in the past such as
>>> [a..b] and [a...b] which would be the equivalent of [a->b] and [a=>b];
>>> however, the extra "." might sometimes be difficult to read, whereas
>>> the difference between "->" and "=>" is much easier to see.
>>
>> You're right.  This is one of the reasons I hate Ruby.  Yet another
>> reason to ignore your suggestion for slices :-).
>>
> Hmm... this is one of the reason you really like it (see above) and
> hate it too! ;-)
>
> Sorry, I couldn't resist ;-)

Teach me a lesson inconsistency, will you!

Yeah, what I meant was that the math side of me really liked using
ellipses to mark ranges, but the reading side of me hated figuring out
the difference between '..' and '...'.  I'd say forget about the
inclusive/exclusive part, keep that the way it is now, and just change
the colon to '...', if we decide to change anything about slices,
which I'm not convinced is necessary.

-- 
Cheers,
Leif



More information about the Python-ideas mailing list