5 ms·
The blog entry titled "Less variables, more flows example vs Python" is strange. ( https://ryelang.blogspot.com/2021/11/less-variables-more-flows-example-vs.htm
by warvariuc 2y ago
The blog entry titled "Less variables, more flows example vs Python" is strange. ( https://ryelang.blogspot.com/2021/11/less-variables-more-flows-example-vs.html?lr=1 https://ryelang.blogspot.com/2021/11/less-variables-more-flo... )
The Python version uses intermediate variables so the author of the code is to blame for verbosity, not the language.
- middayc 2y agoThis was written in 2021, maybe it's really not that great of a blogpost. I wrote a lot of blogposts from many angles back then, mostly to myself as there weren't many readers, trying to see the language from the outside, to self-motivate, etc ... I think I wrote a script I needed in Rye and I found it interesting, then I went to Fiver and paid someone to write a script in Python that does the same. 2021 were different times, and I hope I've grown a little too... and now I would ask ChatGPT or Gemini :)
- woolion 2y agoIt is a legitimate complaint of the language as there are language-related reasons that motivates it --the conciseness of the language has an impact on readability, but also how convenient it is to debug on separate lines. The code examples are a tad too verbose but actually better quality than most real-world Python codebases, I would say. Python is not very verbose but it's not very concise either (especially compared to Lisp families)
- amluto 2y agoISTM the big difference is that the Python code is doing CGI essentially from scratch, but the rye code appears to be using a CGI library.
- middayc 2y agoThe Pyhton side does have import cgi. It also uses req library for request parsing and making a post request. Only for cookies it uses os.environ which is maybe a little unusual, but I didn't specify in fiverr request what libraries to use or not use.
- elbear 2y agoI don't see fewer variables as something good. On the contrary, I find a long "flow" or chain of function calls harder to read or grok. Variables also help readability, because the name can help you discern what those functions return.
- middayc 2y agoThis is a valid argument. There are already a plenty of programming languages where you can do that. You can make temporary variables in Rye too, but it also tries to work well for these chains of expressions or function calls, and I personally prefer this style many times. There is no wrong way, IMO.
- elbear 2y agoIf you're the only one reading the code, then sure write it however you like it. But using long chains of expressions is the same as one-liners or point-free style in Haskell. It saves some typing and also you can skim the code more easily, but only if you're extremely familiar with what's going on there. I wonder how much you can benefit from this, if you return to the codebase after a 6-month break though. Maybe some people do manage to really memorise these details, but for some of us the effect is more like "wtf is this code doing?"
- tome 2y agoFWIW Haskell is the only language in which I've been able to return to code that I wrote six months later and still understand it.