Can someone help me understand the rationale behind semantic whitespace as a replacement for explicit delimiters? Is it purely aesthetic?
Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
41–50 of 78 posts
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#42I've ended up using Groovy for this level of scripting, and it works really well.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#43Can someone help me understand the rationale behind semantic whitespace as a replacement for explicit delimiters? Is it purely aesthetic?
I'd call it pragmatic.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#44Earlier quoted context omitted.
It forces consistent formatting within a file. But I think it was more relevant years ago. These days I see a lot of people using code formatters.
I still think one of Go’s best contributions was formatting with ‘go fmt’. It’s refreshing to see so many language communities just embrace a format on save standard and keep it moving. Reading Python has always been a bit of a headache for me, but that probably has as much to do with the lack of type annotations as it does the lack of braces.
However, languages that have a line length limit are the blight of them. There isn't a python formatter that won't make everything mush. My if clause that is 81 chars wide doesn't need to be broken up. Similar, my strings don't need to be reflowed.
Go fmt ignores line length, and always produces a formatted file that is pretty as a result.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#45Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#46Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#47It's a shame Python doesn't natively support easy invocation from command line. It really shoots down a whole class of applications where bash is getting used but Python would be so much better. I've ended up using Groovy for this level of scripting, and it works really well.
#!/usr/bin/env python
print("Hello, world!")
and mark it as executable (chmod +x /tmp/test.py), I can just execute it as /tmp/test.py like I would do with any bash file.If you mean invocation as "execute a command that I'm passing", 'python -c' does exactly that.
Even as a complete shell it works including changing directories and using standard python to do file IO, though it won't execute any system executables and doesn't do piping like you'd like from a shell. It's not intended for that purpose so I can't really blame python for that.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#48Earlier quoted context omitted.
I still think one of Go’s best contributions was formatting with ‘go fmt’. It’s refreshing to see so many language communities just embrace a format on save standard and keep it moving. Reading Python has always been a bit of a headache for me, but that probably has as much to do with the lack of type annotations as it does the lack of braces.
Auto formatters are the future, why should humans ever have to manually format or discuss how it should look ever again. However, languages that have a line length limit are the blight of them. There isn't a python formatter that won't make everything mush. My if clause that is 81 chars wide doesn't need to be broken up. Similar, my strings don't need to be reflowed. Go fmt ignores line length, and always produces a…
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#49It's a shame Python doesn't natively support easy invocation from command line. It really shoots down a whole class of applications where bash is getting used but Python would be so much better. I've ended up using Groovy for this level of scripting, and it works really well.
Re: Show HN: Making Python one-liner-fit with the new pwk (Python With Kurly braces)
#50Earlier quoted context omitted.
Auto formatters are the future, why should humans ever have to manually format or discuss how it should look ever again. However, languages that have a line length limit are the blight of them. There isn't a python formatter that won't make everything mush. My if clause that is 81 chars wide doesn't need to be broken up. Similar, my strings don't need to be reflowed. Go fmt ignores line length, and always produces a…
You can change the max line length in black (the Python formatter I hear mentioned most often). How would you feel about setting it to something really large, like 1000, to emulate having no line length limit?
I don't like long lines, but reflowing logic is way to aggressive in these formatters.