"Humane" programmer interfaces

Andrew Durdin adurdin at gmail.com
Thu Dec 29 19:01:08 EST 2005


On 29 Dec 2005 09:50:57 -0800, colinwb <colinwb at yahoo.co.uk> wrote:
>
> >> puts ck.first, ck[0], '*', ck.last, ck[-1]

One of the points at issue (minimalism/monotony) relates to TOOWTDI,
which has implications for language/module design and for code
readability. Ruby supports negative indices in the same way as Python,
so why add .last as an alias for [-1]? It's just added mental baggage.
And if you think .last is significantly more readable or convenient
than [-1], why not add .secondlast ?  And .first, and .second ?   With
one simple, obvious, general interface, these special cases only add
unneeded complexity.

Non est ponenda pluritas sine necessitate -- William of Ockham.

Andrew



More information about the Python-list mailing list