Live data from Hacker News

Ask HN:Why is Perl so dwarfed in data science by Python?

news.ycombinator.com

81–90 of 120 posts

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#81
post #77

Earlier quoted context omitted.

> 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…

> 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 scien…

We'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.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#82
post #45

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 th…

Python 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)*…

I 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.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#83
post #60

Earlier quoted context omitted.

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…

> 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…

> performance is mostly good enough across all languages

Performance of applications written in Python is good enough only were there is a very low requirement for fast code (e.g. glue code / shell replacement of which there is a lot and, as computers get faster, more and more) or there are native code libraries (e.g. numpy). Of the popular languages, only Ruby is slower. I have high hopes for Julia (at least in the data science / numerical computing domain) which performs much better, while preserving readability and ease of use of Python.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#84
post #80
post #32

I do love Perl. However, for data science, the biggest drawback vs Python is how you work with complex data structures. Because everything in Python is an object, (de)referencing things is generally straightforward, like: somelist[12]['whatever']="abc" mylen=len(somelist) Where Perl devolves into a mess of sigils, when to use $ vs % vs @, wrapping references with {}, etc. $somelist[12]{'whatever'}="abc"; $mylen=lengt…

It is not entirely about the syntax, for example, the code looks similar in Python (if I remember Perl correctly): print(f"it turns out that {TV[family]['lead']} has ", end=‘’) print(len(TV[family]['kids']), " kids named ", end='') print(*[kid.name for kid in TV[family]['kids']], sep=', ') For me, it was the culture “there is _one_ obvious (for a Dutch) way to do it” vs. “many” in Perl and most people lack discipline…

>the code looks similar in Python

Minus the sigils and crazy wrapping, like: @{ $TV{$family}{kids} } to refer to the array, but a different sigil/form if you're talking about one element, etc.

Which may not look intimidating on its own, but it's leaving out % and the backslash \$reference syntax, $object->method and other things that get confusing.

You can't, for example really make a "list of hashes/dicts". Try it, and it just turns the keys/values into array elements. You have to specifically make a "list of references to hashes/dicts". So you do something like:

  push(@list,\%hash);
Then, fun things like a double sigil:

   foreach my $hashref ( @list ) {
      print keys %$hashref;
   }
Note there are several ways to do all this, and I am highlighting some of the more visually confusing ones.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#85
post #77

Earlier quoted context omitted.

> 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 scien…

We'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 200…

> 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-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.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#86
In my opinion, as someone who worked a short time in perl, perl is so much harder to learn, especially comming from other programing languages (which most data scientists learn if they started from a degree in computer science/engineering)

One of the main issues I have with perl is the `there is more than one way to do it` slogan, which, for me, means that each person what writes perl, writes practically a different language. This make the bar of starting a new project much higher, even if you have use perl before.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#87

Earlier quoted context omitted.

Python 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)*…

You 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.

> 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.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#88
post #11

PDL is just awesome, but I feel that Perl is a programmer's programming language. If you come from Linux, shell scripting, C/C++, etc, you'll probably handle Perl well. However, it might be a bit too much if you are from other fields and just want to get your sums in order.

I came from Linux, shell scripting and C/C++ and still, Perl and me just didn't get along. Only after I learned Common Lisp much later in life, Perl made more sense, but by then it was almost entirely replaced by Python and Ruby.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#89
post #80
post #32

I do love Perl. However, for data science, the biggest drawback vs Python is how you work with complex data structures. Because everything in Python is an object, (de)referencing things is generally straightforward, like: somelist[12]['whatever']="abc" mylen=len(somelist) Where Perl devolves into a mess of sigils, when to use $ vs % vs @, wrapping references with {}, etc. $somelist[12]{'whatever'}="abc"; $mylen=lengt…

It is not entirely about the syntax, for example, the code looks similar in Python (if I remember Perl correctly): print(f"it turns out that {TV[family]['lead']} has ", end=‘’) print(len(TV[family]['kids']), " kids named ", end='') print(*[kid.name for kid in TV[family]['kids']], sep=', ') For me, it was the culture “there is _one_ obvious (for a Dutch) way to do it” vs. “many” in Perl and most people lack discipline…

For printing strings, there is more than one way to do it in Python; differently readable for.

    print("""It turns out that {} has {} kids named {}""".format(
        TV[family]['lead'],
        len(TV[family]['kids'],
        ', '.join(*[kid.name for kid in TV[family]['kids']]*)
    )
It doesn't use the nifty f string formatter, but the English sentence part is a bit easier to read.

Re: Ask HN:Why is Perl so dwarfed in data science by Python?

#90
post #85

Earlier quoted context omitted.

We'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 200…

> 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-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 litt…

I don't think Guido did anything special for the scientific/technical/data computing community after he came to Google. Python was on version 2.4 as of 2005, and that version would have been fine to develop against indefinitely. In fact, it's been a huge headache getting scientists to move to Python 3.
Post reply on HN