Re:Dear Python
by llimllib on Tuesday February 02, 2010 @05:08PM
(#1096312)
Maybe by analogy to cddr, ruby should have laast?
[ Parent
| on HN ]
But then you are throwing all the readability gains of list.last vs. list[-1] right out the window and we are back to square one.
I don't think anyone finds Lisp's car and cdr (much less cadr and friends) particularly intuitive when they are first introduced to whichever dialect it happens to be.
You get used to it, and when needed, write specific-case functions for readability that are simple wrappers to those combo functions. Which I think is probably best no matter whether you have last or [-1], this argument is kind of pointless. Step back and think about why you need that item, write a small wrapper function to grab that it and name the wrapper well so it provides a little semantic context to whoever ends up reading the code later.