5 ms·
Readability is really a weak argument. I've seen a lot of unreadable code written by data scientist in Python. And a lot of readable Perl code. It's not about t
by _Mask_ 5y ago
Readability is really a weak argument.
I've seen a lot of unreadable code written by data scientist in Python. And a lot of readable Perl code. It's not about the language, it's about the best practices.
The concept behind sigils is very simple and once you've learned it, it's not that threatening. And when talking about data structures, it is a benefit to have it more structured and know that you are dealing with an array or hash or scalar.
In my opinion, Perl is not used for data science because it lacks(or people are not aware of) libraries like numpy, pandas, etc.
- deleted 5y ago[deleted]
- civilized 5y ago> Readability is really a weak argument. I vehemently disagree. When choosing among languages today, performance is mostly good enough across all languages and readability becomes the most important consideration. It's "subjective", but human beings are subjects, and subjective things are important to them. > I've seen a lot of unreadable code written by data scientist in Python. And a lot of readable Perl code. It's not about the language, it's about the best practices. This is a bad and cliche argument. Yes, there is well-written code in languages that deprioritize readability and badly-written code in languages that highly prioritize readability. That doesn't mean that any differences in the inherent, built-in readability of X and Y are moot. And "best practices", which are not widely agreed upon or followed, absolutely do not suffice to paper over this. > The concept behind sigils is very simple and once you've learned it, it's not that threatening. "Once you've learned it" or "get used to it" is the biggest programming cliche in the world. People say this about all their favorite languages and language features. I'm sure I could complain about doing data science in Brainfuck and get someone in the comments who would say it's not threatening "once you get used to it". Well sorry, but I don't want to get used to your favorite language's line noise. That's why I choose another language. That's why everyone else chooses another language. > And when talking about data structures, it is a benefit to have it more structured and know that you are dealing with an array or hash or scalar. You can keep track of types in Python with gradual typing. Most people don't bother, so evidently it's not that important in most cases, but you can do it. Other than that, no, I don't need to fill my code with more line noise to constantly remind myself what type of container I'm dealing with. That's obvious enough from the methods I'm using to manipulate the container. > In my opinion, Perl is not used for data science because it lacks(or people are not aware of) libraries like numpy, pandas, etc. No, this is after the horse has already left the barn. Those libraries were developed in Python because the authors of those libraries preferred to work in Python. The authors preferred to work in Python because of the legibility considerations I've already mentioned. Python's design and adoption were both heavily driven by a vision of readability from the very earliest stages in the 1980s/90s. People got into Python because they liked how the code looked: > A friend of mine who knows nearly all the widely used languages uses Python for most of his projects. He says the main reason is that he likes the way source code looks. That may seem a frivolous reason to choose one language over another. But it is not so frivolous as it sounds: when you program, you spend more time reading code than writing it. You push blobs of source code around the way a sculptor does blobs of clay. So a language that makes source code ugly is maddening to an exacting programmer, as clay full of lumps would be to a sculptor. - Paul Graham (http://www.paulgraham.com/pypar.html http://www.paulgraham.com/pypar.html, August 2004)
- _Mask_ 5y ago> I vehemently disagree. Readability is the most important consideration. It's "subjective", but most human "subjects" prefer Python to Perl on this dimension, and it's very important to them. That's why we are where we are today. I absolutely agree that readability is most important consideration. I just disagree that it depends on the language. As said before, there is a lot of write-only code written by data scientists in Python. > Well sorry, but I don't want to get used to your favorite language's line noise. That's why I choose another language. That's why everyone else chooses another language. You don't have to. It's called a programming language paradigm, not noise. You either learn it or not when studying a language. If you want to understand something without studying it, it's your choice. I am proficient in both of these languages and can see the strengths and weaknesses in both of them. > Those libraries were developed in Python because the authors of those libraries preferred to work in Python. The authors preferred to work in Python because of the legibility considerations I've already mentioned. Perl was extensively used by scientific community, but Python was the lucky one that was backed by Google in 2005. And that's ok. It is better than Perl for data science now, but not because of its syntax :)
- civilized 5y agoWe'll have to agree to disagree on most of this, which is fine, better than having a stupidity-driven argument. I'm sure the aspects of Perl that are weird and gross to me are great for some other people. > Perl was extensively used by scientific community, but Python was the lucky one that was backed by Google in 2005. I'm curious about this. Can you point to any specific evidence that being "backed by Google in 2005" was a momentous event for Python? AFAIK Google is not a major player in the Python scientific computing / data analysis / ML community outside of TensorFlow, which was introduced after Python was already huge.
- _Mask_ 5y ago> I'm curious about this. Can you point to any specific evidence that being "backed by Google in 2005" was a momentous event for Python? Here are some stats with the popularity of various languages over time: https://statisticsanddata.org/data/the-most-popular-programming-languages-1965-2021/ https://statisticsanddata.org/data/the-most-popular-programm... In 2005 Google hired Guido van Rossum, where he spent half of his time developing the Python language. As you can see, before 2006, Python was little less popular than Perl(9th vs 8th). By the time Guido left Google(December 2012), Python became 4th most popular programming language.
- bsder 5y ago> Readability is really a weak argument. I strongly disagree. As someone who had to interview for VLSI design positions (both sides of the table) back when Perl was popular, I used to take a printout of a small tool I developed in Perl with me to every interview (parse a VCD file and check the results). This forced the interviewers into MY subset of Perl. That made a huge difference into how competent they thought I was with Perl. Most of the interviewers gave up after we went through about 10-20 lines of code because they had never seen half of the stuff in my code--and I wasn't doing anything particularly obscure (decorate-sort-undecorate/Schwartzian transform would lose most of them).
- civilized 5y agoI guess I'm showing my youth here but I never imagined that sorting on a computed key was once known by such an exalted title as Schwartzian Transform. This is basic, built-in functionality in Python.
- bsder 5y agoIt's not just that the key is computed, but that the key has an internal sort comparison which is way faster than a user code comparison. It was an example of the fact that "Big-Oh notation is nice, but constants sometimes matter." Both sorts have the same O(n log n) number of operations performance. However, in Perl, using an internal comparison for integers was a significant constant faster than using a user specified comparison function--at least an order of magnitude and sometimes two. Consequently, the 2*O(n) to decorate and undecorate the list with integers to sort by got swamped by the 1/10*O(n log n) sort improvement. I believe that this overhead eventually got reduced. However, I remember using this a LOT in Perl 4 and early Perl 5 days.
- civilized 5y agoSounds generally plausible to me. I learned all sorts of obscure tricks to make MATLAB run faster in my grad school days... I wouldn't be surprised if something like this was useful over there as well.
- mayankkaizen 5y agoUnless you are hell-bent on writing obfuscated code, Python code is almost always readable. Even when I didn't know any Python or any other language, I could make an educated guess what some Python program is doing. However, I have seen some of Perl code and I was like wtf. As for best practices, Python does insist on writing readable code a lot. Python people always nudge you to write readable code. Guido himself said he designed Python to be a readable language.In general, Python has the philosophy of one way of doing something which contrasts with Perl way where you can accomplish a task in numerous ways. You can't be too clever with Python (little exaggerated position). However, the same is not true with Perl.