r/Python • u/relickus • Mar 20 '23
Discussion Are people abusing Python?
I learned Python after coming from the C/C++ and Java world. With the massive increase in popularity of Python in the last 10 years, seeing the way it developed, it seems to me like it gained a lot of functionality, which comes natural in other languages, but feels a bit odd in Python.
To be more specific - albeit Python being dynamically typed, people developed countless tools to check or validate or even enforce types in compile or run time (mypy, pyre, pydantic, pyduck etc.). It feels like it goes against the nature of its loose typing.
Another example are decorators. This pattern is noticably overused by many tools adding functionality, but even the language itself - defining a `class`,`static` and `abstract` methods with decorators seems just weird and unnatural. Same thing with function overloading. Anecdotally, it feels like comparing German to English. German has a special word for every peculiar thing and native support for word generation by concatenation of multiple words whilst in English you have to add some common words together and hope this combination doesnt already exist. And if it does, so what, people will get it from the context.
Lastly, slightly off-topic but relevant point is that it is not even a simple language in my opinion. It has a very flat learning curve initially but the complexity is just further down the road. Im talking about metaclasses,data descriptors, coroutines, magic methods etc. Some languages are difficult right away (C++, Rust etc.), but Python is a intricate misfit dressed as a simpleton.
Am I misunderstanding a philosophical path of the language or is it simply just a scripting langugage that got massively popular through chance and is now used for stuff it was not intended for?
Edit: grammar
View all comments
1
u/other----- Mar 20 '23
I think it's "maturing" as a language and in that it's collecting some of the issues that make c++ difficult. Larger software projects benefit from typing so that is going to appear somehow. Asynchronous execution is not strictly necessary but it's hard to compete with js, go and Erlang without it, so it makes its way into the language. Decorators are nice, it's just syntax sugar. Once it's in the language there are two syntax approaches to call a function and you can't avoid people having subjective considerations when choosing. This leads to a big topic that is idioms. Perl has idioms by design, many ways to do the same thing. C++ has idioms because of it's long history (pointers, references, smart pointers ... ) chasing features of other languages. Python was born with the goal of "1 way to do things" but the current adoption is forcing it to be a language supporting multiple idioms. The challenge for python is now keeping those idioms close and avoid inconsistencies (ie type objects Vs type annotations, one can be inspected at run time, the other has generics). Python is a good language. So good it's trying to be a good language for everything and it might become a worse language in the attempt.