← Back to context

Comment by Waterluvian

3 years ago

I’m not sure I understand the “this is why” part. Python wants to let you override almost everything. It’s a feature and a powerful and occasionally helpful one. It’s also a feature you never ever have to know about or touch.

This debate could be summed up as:

There's more than one way to do it *vs* there should be one, and preferably only one, obvious way to do it

  • > there should be one, and preferably only one, obvious way to do it

    Loops, list/dict comprehensions, if statements, and ternary expressions would all like a word

    • The same debate applies to all of those things, so this is just another instance of Python battling with a philosophical principle underlying the language, which naturally arises anytime a redundant (but good) feature like this is added to the language

Agreed - I mostly use Python for small scripts and it makes that use case very easy. I know it has a bunch more features for more niche stuff as well but my throwaway script to download images from a webpage doesn't need pattern matching.

It's like python's metaclasses. You rarely need them but sometimes they really are just the best solution to the problem. Those times, you're really glad they're available.

> It’s also a feature you never ever have to know about or touch.

The "never have to know or touch" argument applies only to the lone hacker working on a completely new project with no inherited legacy code.

  • Indeed. Most Python code bases I have seen are maxing out all obscure features like those in the article. In practice, Python today is one of the most unreadable languages in existence.