2 ms·
My key complaints are the complete lack of clarity as to what kind of thing split is The post seems to be about language independent readability. Rather than "
by petercooper 16y ago
My key complaints are the complete lack of clarity as to what kind of thing split is
The post seems to be about language independent readability. Rather than "functions should be called with () - that is clearly not a function - can not compute!!", the question is "can this code be understood even ignoring unfamiliar syntax?"
Most developers familiar with languages like Java, JavaScript, Python, Perl, C# or Ruby could correctly guess what "split" refers to and that it is unlikely to be used as a variable name. Further, if a developer is familiar with the idea of method calls, it will be inferred that "whatever.split.whatever" is a sequence of method calls.. much as if it were, in some fictional languages, whatever->split->whatever or whatever:split:whatever. Similarly, a(b(c())) and a[b[c[]]] could both be easily inferred to be a set of nested function calls.
"import sys" is not exactly clear either, but again, the meaning of this could be accurately inferred by most developers.
print '\n'.join(filter(line.split(), lambda word: word.endswith('ing'))
I want to join the array's elements together, not join the string. Joining together an array's elements by calling a method on the delimiter is no less raving than any Ruby I may cook up. Your example is both longer and has more syntax.