In a similar vein, pyp: https://github.com/hauntsaninja/pyp
Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
71–78 of 78 posts
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#72I 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?
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 (Python With Kurly braces)
#73I would like to see a pip package for this sometime but also maybe some consideration for integration with other previous similar attempts or other similar projects which I just learned about today.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#74Face 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] https://twitter.com/AbhishekGhose/status/500564420733304833?...
[2] http://quipu-strands.blogspot.com/2014/08/knn-classifier-in-...
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#75I 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?
>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 (Python With Kurly braces)
#76I tried a few (not all) of the examples with plain old Python (granted, these are multi-liners, not one-liners, but I think they're easier to read). I'm not sure I see the advantange of curly braces. # --- Example 1 # pwk pwk 'if "braces"=="bad": { print("Be gone!"); exit(99) } else: { print("Howdy!") }' # vs # python python -c 'if "braces"=="bad": print("Be gone!"); exit(99) else: print("Howdy!")' # --- Example 2 pw…
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#77Can someone help me understand the rationale behind semantic whitespace as a replacement for explicit delimiters? Is it purely aesthetic?
It forces you to write "good" code. I think it's Python's only real strength. The language is ugly, the interpreter is a genuinely deficient way of making software ("Why use a compiler when you can just write thousands of unit tests to check for syntax errors!?"), and the mechanisms for abstraction are fairly weak - even after all that, n00b Python code is fairly readable.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#78Not even a nod to __future__.braces?
$ python -c 'from __future__ import braces'
File "", line 1
SyntaxError: not a chance