Hacker News new | ask | show | jobs
by cutler 2042 days ago
Face it - Python just ain't fit for one-liners. Give Perl and Ruby some credit as they were designed for conciseness and the command-line. Python may dominate data science, AI and ML but it's deficiencies bleed through when you try to compose something elegant and concise.
1 comments

I agree about Perl; haven't done a lot of one liners with Ruby when I was using the language. Perl was made to be really compact to the detriment of being hard to read. I think Python strikes a nice balance, and you can compress it to a point. In discussions like these I always like to bring out my one-liner k-nearest neighbor classifier [1]! Explanation here [2] (better on a desktop).

[1] https://twitter.com/AbhishekGhose/status/500564420733304833?...

[2] http://quipu-strands.blogspot.com/2014/08/knn-classifier-in-...