I've been writing a lot of JavaScript lately, and I constantly wish that there were an alternative designed by one person, rather than by historical accidents followed by a committee. My kingdom for a Python-like or Ruby-like or even a Perl-like!
FWIW I think most folks would consider `g(f.last)` more idiomatic in Ruby (not sure about Python). I've personally never found `-1` meaning end of the array particularly obvious or intuitive
-
-
(Python lacks no last(). Ruby/Python are opposites in terms of core type method bloat.) Ruby: > [].methods.length => 177 Python: >>> len(dir([])) 45 But only 9 of those are intended for direct calls (don't begin in "_")! >>> len([m for m in dir([]) if not m.startswith('_')]) 9
-
Python trends towards top level functions for things that Ruby puts on Enumerable though, right? e.g. it's `len(list)` not `list.len()`
- 7 more replies
New conversation -
-
-
That's definitely true. But that just raises an even more obvious question: why doesn't JavaScript just have last()?!
-
100% agree that lacking`.last()` makes no sense
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.