Comment by Surac
3 days ago
I at the moment try to learn python as a hobby language. I use c c++ and c# to earn my money. MY biggest problem is finding good examples that are up to date. I spent a whole day learning that there a four (I think) ways to do formatting strings. This „bloat“ in syntax makes even a simple print very heavy to digest. I don’t even bother using v2 python only v3. Also using whitespaces to block things together sounds appealing but in reality you need to use editors that can indent and unindent whole blocks or I never get it right
15 years ago, Python programmers used to mock Perl by quoting the Zen of Python: "There should be one - and preferably only one - obvious way to do it.". This was in stark contrast to Perl's TIMTOWTDI motto: "There Is More Than One Way To Do It."
The Zen of Python is sadly now an absolute lie.
Rather than an absolute lie, I’m more inclined to characterize it as naïve or black-and-white thinking, outside of CRUD apps and undergraduate intro projects.
You seem to be making things more difficult for yourself than they need to be.
For the strings, just use f-strings and forget all the others. You can even do things like this for debugging:
For the block indenting, what editor are you using? Pretty much every modern editor lets you select a block and indent/unindent with Tab/Shift+Tab.
VS Code and PyCharm are both free and are great for Python coding. They each have a full debugger, which is invaluable when you are learning a language.
I think their point is that it's not clear to someone with 0% Python experience which of the /many/ different ways of doing things (like string interpolation) is the "correct" / idiomatic way.
> but in reality you need to use editors that can indent and unindent whole blocks or I never get it right
What editor are you using that can't do that? Notepad?