Sunday, February 11, 2018

Python’s philosophy Once again

Let's restate the Python's philosophy from the Python terminal itself:

>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Now I realize, learning a programming language is not that difficult (Disclaimer: Not counting Brainfuck category of languages), however learning software engineering is what it's really hard. Writing code is the easiest part that you could ever do, what indeed matters is how you "engineer" your program. What I need now is to slowly let principles of PEP8 and Flake8 coding guidelines sink into the psyche. My most favorite guideline from PEP8 cookbook:

"Know when to be inconsistent -- sometimes style guide recommendations just aren't applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!"

References:
[1]. https://www.python.org/dev/peps/pep-0008/#introduction
[2]. http://flake8.pycqa.org/en/latest/