5 ms·
I disagree. To me Perl is more readable than Python. What is so modern about Python? It was released in 1991.
by vgy7ujm 9y ago
I disagree. To me Perl is more readable than Python. What is so modern about Python? It was released in 1991.
- toyg 9y agoCompared to Perl, the overall under-use of special characters and the forced indentation make it objectively more readable; there is a reason it's often compared to pseudocode. Age of release is a meaningless metric, btw. For starters, what Python was in 1991 is very different from what it was in the early 2000s, when it reached critical mass. Its modernity is measurable by the influence it had on most languages designed after its success, like Go and Swift.
- vgy7ujm 9y agoSpecial characters, clear visual markers of scope etc. that Python lacks is part of the appeal of Perl to me. I feel like a dyslectic when I read Python (projects of significant size) due to it being much less visually helpful and that the idea of simplicity falls apart when the problems are not trivial and when multiple devs have touched the code over multiple years. YMMV of course but that is why your POV is not objective and I disagree.
- toyg 9y agoThe visual marker of scope is there and it's massive: indentation. You can write bad code in every syntax, but when a language carries jokes about being "write-only" and the other has a reputation for being anal about indentation (the single most helpful scope-marker in any syntax), I don't think you can argue about objectivity when discussing readability. This said, I'd like to see scientific comparisons, which are lacking. Some studies suggest terse languages using more special characters are more readable to experienced programmers than ones with simpler syntax, which seems to match your experience. That might well be true; but when applied to the real world, this still means than only a minority will ever prefer that style over a simpler one. As the number of coders naturally rises, this will only become more and more true over time.
- newen 9y agoBro, literally every language does indentation. Python just does indentation badly by making it syntactically significant. Also. If you're going to come back to me with the argument that it forces people to use indentation, I've got some news for you. Literally everyone uses indentation. And if you somehow come across code written by the rare soul that doesn't use indentation, all I've to do is select the entire code and click "re-indent". Which, btw, in python is a chore to fix badly indented code with tabs and spaces mixed in together. And it's even more work to properly copy-paste python code, even in good editors.
- mixmastamyk 9y ago> everyone uses indentation. Yes, if you don’t you’re incompetent. If you do, the markers are then redundant. Mixed indentation hasn’t been allowed in years. Any good editor will show mixed indentation, guides, and indent properly with the tab key, get one. Sounds like your knowledge of Python is about a decade behind. Not to mention those were nonissues from my experience even back in the day.
- newen 9y agoThese issues are only there because python has significant whitespace. These issues should not have been there in the first place. Ideally, I shouldn't need to use an editor geared specifically for python code to copy-paste some python code and run it. I have had no issues with the majority of other languages when copy-pasting some code and reindenting. Only in python have I had issues with it. Even in elpy-mode in Emacs, I have had issues. Another is Jupyter/IPython, a widely used python IDE for data scientists, where this problem crops up all the time. So lay off with the superior attitude.
- emmelaich 9y agoWhen I started writing C a million years ago I thought to myself -- why the f$# does the compiler need to be told twice what the structure of my code is? Once with {} and once with indentation. It's not as if anyone half-sensible is going to write good code with bad indentation. With that thought in mind, I am pathetically grateful for Python.
- MadcapJake 9y ago> Its modernity is measurable by the influence it had on most languages designed after its success, like Go and Swift. So you are measuring "modernity" by legacy? Also, I don't see any Python influence in Go and from the brief exposure I've had to Swift, I'd say there isn't much influence there either. By your axiom, one could argue that C is a modern language.
- toyg 9y ago> I don't see any Python influence in Go Well, in Google's own words[1]: "Go attempts to combine the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++". Some go datastructures are very python-like. Coming from a big Python shop, it's unsurprising. Chris Lattner mentions Python[2] as an influence among others. Swift's lists and dicts are very python-like. The way python deals with datastructures is one of its strong points, and it's clearly more modern than anything C-like. Both Go and Swift are more restrictive than Python in many ways, mostly for performance reasons since they are built for specific needs, but the influence is there and openly admitted. [1] https://techcrunch.com/2009/11/10/google-go-language/ https://techcrunch.com/2009/11/10/google-go-language/ [2] http://nondot.org/sabre/ http://nondot.org/sabre/
- simias 9y agoTo me python and perl and two extremes. Perl is almost comical with its use of special characters (which they've embraced even more in Perl 6 with the optional use of unicode symbols in built-in operators) but python went too far the other way IMO. "It looks like pseudocode" sounds nice in theory but people don't typically write huge projects in pseudocode. I don't really like the significant indentation but my main problem is with the awkward scoping rules. I also find that it makes it harder to refactor code (if I copy/paste a snippet at a different level of indentation I can't blindly trust the editor to re-indent it properly). That being said I agree that these days the tendency across all languages is to go towards fewer special characters, not more. In this context Perl 6's syntax feels a bit anachronistic. Maybe you'll be able to win a few new user by telling them that in Perl 6 they can use × for *, Ⅻ for 12 and [unicode atom symbol]++ (ironically HN automatically removes the actual symbol when I submit) for atomic incrementation but I expect that many more will recoil in horror. I won't even talk about »=» and the ascii equivalent >>[=]>>.
- sedachv 9y ago> That being said I agree that these days the tendency across all languages is to go towards fewer special characters, not more. In this context Perl 6's syntax feels a bit anachronistic. This is just a comeback of a recurring dumb trend based on the fallacy that describing the operations of a program using English words is always superior to using appropriate specialized notation. The core of the fallacy is assuming that because something looks like a familiar English word, people who do not understand programming will understand the corresponding semantics of the operation in the programming language, because they know English. Which is complete nonsense - people who do not understand programming will reason by analogy, and through trial and error end up at a partially wrong and misguided understanding of that operation. English words only start you off with unnecessary baggage in the learning process. It is even worse for people who already know programming. A C for loop is not a JavaScript for loop is not a Python for loop... The details of their semantics are very different, and you will introduce bugs if you just assume "I know how for loops work!" There is nothing new about this trend either; it was the central premise behind COBOL, and a big motivation for BASIC. What BASIC was in the 1980s, Python is today. What is ironic about this trend resurfacing today is that it has never been easier to use special characters - Unicode is everywhere, and even making custom keyboards has turned from a major manufacturing endeavor to an accessible hobby: https://www.youtube.com/watch?v=uk3A41U0iO4 https://www.youtube.com/watch?v=uk3A41U0iO4
- octothorp3 9y ago>>To me Perl is more readable than Python. There's a phrase I never thought I'd see.