4 ms·
"Why should the language have opinions about how I should or shouldn’t structure my code?" Isn't that what attracts so many people to Python in the first place
by ghshephard 5y ago
"Why should the language have opinions about how I should or shouldn’t structure my code?"
Isn't that what attracts so many people to Python in the first place - that it does have strong opinions, and often enforces them on how people should structure their code.
Python, in many places, optimizes for readability, rather than flexibility, and there is a community of users that really appreciate that. Not to say the feeling is universal (clearly isn't) - but it's at least an answer to the "why?"
- staticassertion 5y ago> Isn't that what attracts so many people to Python in the first place - that it does have strong opinions, and often enforces them on how people should structure their code. I seriously doubt it. What attracts people to Python is that: 1. It has a big standard library and until the last ~10 years installing 3rd party packages was beyond the capabilities of your average CS student. 2. It is easy to write relative to C++. If you're in data science, those are your two options, so you choose Python. Python is an extremely loose language - it's not restrictive at all in ways that matter. Is "you can't use two lines (unless you use a \)" restrictive when your language lets you arbitrarily replace functions at runtime? It's not at all a readable language imo. It is very much write-optimized. It has tons of code golfing and one liners.
- fault1 5y ago> It's not at all a readable language imo. It is very much write-optimized. It has tons of code golfing and one liners. Agreed. This might have been applied to the "Zen of Python" days back in 1999, when the competition was Perl, but python has slowly morphed into a more and more perl-like language.
- cygx 5y agoIt's not at all a readable language imo. Compared to what? Python's closest peers are arguably the members of the P*-family of programming languages (Perl, Python, PHP, with Ruby as honorary member), and among that group, Python traditionally skews towards the readability end of the spectrum.
- staticassertion 5y agoCompared to languages without inheritance and with types, primarily. Dynamic typing + inheritance leads + a lot of one liners leads to really hard to read code.
- KerrAvon 5y agoEh. Complex Ruby can be much more readable than complex modern Python. PHP and Perl, sure, usually.
- matheusmoreira 5y agoWhat attracts people to Python is the fact people have already solved most problems and they can just import the stuff they need.
- School-Cotton 5y ago> it does have strong opinions, and often enforces them on how people should structure their code Like what? Where else does Python arbitrarily limit how many tokens may be part of a particular construct, or do anything else remotely similar?