Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by xupybd on Monday November 23, 2020 @12:52AM
(#25183963)
I really don't understand the love of one liners. Yes it's cool to see how much can be done in one line but it's so much harder to read. Isn't legibility far better than compactness?
[ Parent
| on HN ]
Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by neycmrtn on Monday November 23, 2020 @04:38AM
(#25185068)
Aye, in general legibility >> compactness. Apart from the intellectual exercise (fun; !work), one-liners imo come in handy in:
>some_complex_tool | 'my one liner' | some_other_complex_tool > result.txt
Not putting the one-liner logic into a separate script avoids an additional lookup for someone learning what is going on, along with any deployment/path/.. dependencies to that separate script.
Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by pfranz on Monday November 23, 2020 @01:03AM
(#25184013)
It depends on the context. I like one-liners because it's much easier to iterate over a command line and building them is a bit of a personal challenge since it's not worth writing a script or saving to a file.
I don't know about most people, but interactively I use short flags and when writing Bash scripts I try hard to use long flags and will often break things up specifically for clarity.
Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by xupybd on Monday November 23, 2020 @02:35AM
(#25184386)
Yeah the challenge is a lot of fun I have to admit that.
Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by lordgrenville on Monday November 23, 2020 @01:22AM
(#25184081)
Only advantage I can think of is that you can just paste it in a shell prompt, if you're not comfortable with making a script, changing permissions, etc.