5/6/2023 0 Comments Python clean textThere are numerous coding principles you can follow to write better code, each having their own pros/cons and tradeoffs. If you're curious about the meaning of the "poem", check out The Zen of Python, Explained, which provides a line-by-line explanation. Namespaces are one honking great idea - let 's do more of those! If the implementation is easy to explain, it may be a good idea. If the implementation is hard to explain, it 's a bad idea. Although never is often better than * right * now. Although that way may not be obvious at first unless you 're Dutch. There should be one - and preferably only one - obvious way to do it. In the face of ambiguity, refuse the temptation to guess. Special cases aren 't special enough to break the rules. > import this The Zen of Python, by Tim Peters Beautiful is better than ugly. + 10.Ī non-Pythonic solution would be something like this: We have to add the first 10 numbers together like so 1 + 2 +. To write Pythonic code you can't just idiomatically translate another language (like Java or C++) to Python you need to be thinking in Python to being with. There's a big difference between writing Python code and writing Pythonic code.
0 Comments
Leave a Reply. |