4 ms·
> I'm not even a Python guy at all but I'll go back to my favorite truism from the Zen of Python: explicit is better than implicit. The Zen of Python is more o
by imiric 5y ago
> I'm not even a Python guy at all but I'll go back to my favorite truism from the Zen of Python: explicit is better than implicit.
The Zen of Python is more of a meme than a list of guiding design principles of the language. This explicit over implicit one in particular.
Python does things very implicitly. It encourages operator overloading, so you're never really sure what `a + b` does without seeing the `__add__` implementation. Same for `len()`, `str()` and a few others.
Metaprogramming is also considered an advanced topic and used extensively in the wild.
Python programmers love implicit behavior and building abstractions that hide the complexity away. It's kind of what the language is about, so being explicit over implicit is rarely followed.
Similarly for the other points in the Zen. "There should be one obvious way to do it" is an internal joke; the Dutch line following it is the punchline. While it doesn't follow Perl's extreme TMTOWTDI mantra, there are often many non-obvious ways of doing the same thing in Python. See `str.format()`/`%`/f-strings, for loop/comprehensions, enum implementations, the packaging mess, etc.
A language that follows explicit over implicit and one way of doing things is Go, where you're actually forced to do things a certain way because of the design simplicity. Granted, not everything, as generics are now a thing, and modules were a mess for a long time, but it mostly follows Python's Zen more than Python.