3 ms·
Python has a very simple and consistent and unsurprising syntax compared to Perl. I think most programmers from other languages can look at Python and feel like
by macksd 5y ago
Python has a very simple and consistent and unsurprising syntax compared to Perl. I think most programmers from other languages can look at Python and feel like they're reading pseudo-code that they actually understand for most operations. So for people coming from a mathematical or scientific background, it unlocks computing abilities without having to learn a bunch more knowledge from another domain. Add to that the success of libraries like NumPy and SciPy that round out the capabilities of the language itself and make many practical tasks very accessible, and it's just a nuke-from-orbit type situation for most other languages.
I mean, even the author of Learning Perl, said "sometimes Perl looks like line noise to the uninitiated, but to the seasoned Perl programmer, it looks like checksummed line noise with a mission in life."
- azalemeth 5y agoPython can be easy to read, but it's filled with "gotcha's" and occasionally infuriating syntatic "sugar". Don't get me wrong -- I like the language and the ecosystem is increasingly good -- but I find it plenty confusing enough at times. Perl's main footgun was "everything is a regex". Python's is "everything is an object". Of course, that it's main strength. A quick example: $ python3 >>> dir(dir(dir))[(not False)*41].upper() 'INDEX' >>> type(dir(dir(dir))[(not False)*41].upper()) <class 'str'>
- SAI_Peregrinus 5y agoYou can write hard-to-read code in any language. You can't write easy-to-read code in any language. Python tends to make easy-to-read code easier to write than Perl does.
- guenthert 5y ago> You can't write easy-to-read code in any language. I've seen (rarely) old shell scripts and even assembler made readable by copious use of comments. I think the claim should rather be that you can't write easy-to-read self-documenting code in all languages.
- t-3 5y agoThe issue is with data movement, in my opinion. Heavily pipelined command languages like shell and stack languages tend towards unreadable because they perform actions on arbitrary data with implicit transfers between functions, which can be confusing to the uninitiated, because you have to know every (not necessarily obvious) command and it's parameters beforehand.
- macksd 5y agoI agree that a lot of the implicit type conversions are problematic, but Python's handling of that is hardly as unintuitive as things like a lot of Perl syntax, or JavaScript typing, etc. If that's the kind of impractical example you have to come up with to showcase this problem, honestly I think that's still pretty good, and I'd still call the implicit type conversions an overall win for the use case being asked about. I think we could make better languages than Python that fix these issues. Like an implicit boolean -> int conversion does more harm than good, IMO (and it appears in your example). But I'm still not surprised that of the languages we have had when we have had them, that Python absolutely dominates this space.