4 ms·
I should also add a cultural / social reason why Python is used in scientific computing and machine learning much more than JS/Ruby/Perl: Python was the only
by chubot 5y ago
I should also add a cultural / social reason why Python is used in scientific computing and machine learning much more than JS/Ruby/Perl:
Python was the only one of those languages (partially) funded by government research agencies. Guido was a research programmer in the Netherlands at CWI, and then he moved to the US when he was hired by CNRI, a research agency headed by Bob Kahn (loosely connected with DARPA as far as I remember).
If you look at the backgrounds of Brendan Eich, Matz, and Larry Wall (creators of JS, Ruby, and Perl), they are quite different. None of them really worked in a research setting, and they certainly didn't develop their language in a research setting.
https://en.wikipedia.org/wiki/History_of_Python https://en.wikipedia.org/wiki/History_of_Python
3 hour oral history with Guido: https://www.youtube.com/watch?v=Pzkdci2HDpU&t=12s https://www.youtube.com/watch?v=Pzkdci2HDpU&t=12s
Lex Fridman interview with Guido: https://www.youtube.com/watch?v=ghwaIiE3Nd8 https://www.youtube.com/watch?v=ghwaIiE3Nd8
Lua was developed in a research setting, funded partially by Brazilian oil companies as far as I remember, but I don't think it ever had a "scientific computing" focus. It was picked up more in games and apps due to the C embeddability and features like coroutines. The ML framework Torch was built on LuaJIT because it has math nearly as fast as C. But I think the language Lua is less suited toward linear algebra, again due to the lack of operator overloading.
Not to mention that Lua doesn't even have separate ints and floats! This is also an issue with using JavaScript for scientific computing.
- kragen 5y agoPerl was originally written at JPL, which is the epitome of government-funded research, and for the first many years of its life most of its numerous contributors were at one or another government-funded research institution, because people who weren't didn't have internet access. Lua does support operator overloading: $ luajit LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/ JIT: ON SSE2 SSE3 SSE4.1 AMD fold cse dce fwd dse narrow loop abc sink fuse > x = setmetatable({}, {__add=function() return 37 end}) > print(x+5) 37 Not sure if that was true 20 years ago.
- chubot 5y agoHm interesting, it's hard to find references to Wall working at JPL, but here's a very non-authoritative one: https://old.reddit.com/r/perl/comments/5lj9ms/did_larry_wall_work_at_nasa/ https://old.reddit.com/r/perl/comments/5lj9ms/did_larry_wall... Wikipedia doesn't mention it: https://en.wikipedia.org/wiki/Larry_Wall https://en.wikipedia.org/wiki/Larry_Wall https://en.wikipedia.org/wiki/Perl#Early_versions https://en.wikipedia.org/wiki/Perl#Early_versions That does sound right, since I vaguely recall an interview with Wall talking about JPL. ----- I think there's still a difference because Python was literally funded as a research project by CNRI, a government research institution. It wasn't created there, and it was funded by different entities afterward, but I think that's the period when contributors with a scientific background like Travis Oliphant, Jim Huginin, and David Beazley started working on Python's libraries and infrastructure. At best it seems like Wall worked at JPL for a short time and started Perl there. It also matters what kind of research it was. Perl is aimed much more at text processing and not linear algebra, while Python is more general purpose in this respect. Also, if my memory is right, by early 2000's JPL had jobs in Python, and python.org said JPL was a user. I could be wrong but I don't think Perl ever caught on as much as Python did at JPL. ----- Yes good point about Lua's metatable mechanism.
- kragen 5y agoI think Larry was at JPL from before the first version of Perl in 01986; his job before that was evidently at Unisys, maybe starting around 01979: http://web.archive.org/web/19970626151153/https://www1.acm.org/crossroads/xrds1-2/lwall.html http://web.archive.org/web/19970626151153/https://www1.acm.o... https://spu.edu/depts/uc/response/spr2k/wall.html https://spu.edu/depts/uc/response/spr2k/wall.html He was still at JPL in 01991; I suspect but am not sure that he kept working at JPL even after changing his email address and official affiliation to NetLabs. Rich $alz reposted Perl in 01988, bearing a "1987" copyright date, but I think the first version really was released in 01986; at any rate by this point Larry was definitely at JPL: https://www.tuhs.org/Usenet/comp.sources.unix/1988-February/006962.html https://www.tuhs.org/Usenet/comp.sources.unix/1988-February/... Unfortunately Google has decided to remove the ability to view source from Google Groups, so we can't see the return-path for https://groups.google.com/g/comp.lang.perl/c/t4RumjajsXA/m/7VxLCNXOVAcJ?hl=en https://groups.google.com/g/comp.lang.perl/c/t4RumjajsXA/m/7..., one of the earliest messages he posted from netlabs.com, so we can't see what NNTP server he was using at the time. (I guess that's what we get for letting Google take the responsibility for "making information universally accessible": we have no recourse when they decide that means making previously public information inaccessible.) The Wikipedia article says he released the first version of Perl when he was still at Unisys, citing the first edition of Programming Perl, which I don't have. The second edition (01996) is silent on the question. It also cites https://www.oreilly.com/pub/au/148 https://www.oreilly.com/pub/au/148, which does say that and presumably is at least subject to Larry's veto. So, at any rate, JPL was funding Perl development from at least 01987 to 01991, four years, almost the same amount of time that Guido van Rossum was working at CNRI, 01995 to 02000. But you're probably right that Guido had to write grants and write progress reports on Python, and Larry didn't on Perl; he had the discretion to just do it. Also, I suspect this was true when Guido was at CWI too, as you say. AFAICT the only research paper Guido published at CNRI that was about Python was the CP4E paper. I don't think it's accurate to say, "Perl is aimed much more at text processing and not linear algebra, while Python is more general purpose in this respect." PDL/perldl is from 01996, just the year after Numeric in 01995, and Perl 5 offers pretty much exactly the same set of facilities as Python for this sort of thing (dynamically loadable language extensions, operator overloading, dynamic typing --- though I guess at least Python's indexing syntax is more comfortable, because x[i:j, ..., 3] is a valid Python expression that preserves all that indexing structure, and has been since at least 1.5.2). If memory serves, PDL was a lot better at 3-D plotting than Numeric was when I first tried it in about 01998; it could pop up a rotatable 3-D plot in an X window, and Numeric couldn't. I think what happens is that a lot of people started working on Numeric (including those you mention --- although keep in mind dabeaz was also working on Perl's libraries and infrastructure!) and so it started getting better faster than PDL. Part of this was that Python is just a more pleasant, less clumsy language, so people chose it when Perl didn't have a killer advantage, like native mutable strings or a relevant CPAN module. But that's not about Python being well-suited for linear algebra; its only linear-algebra-specific feature is Python 3's @. I think it would be very hard to find anyplace in 01995 or later that had Unix systems and didn't have huge piles of Perl. You're probably the person in the world most aware of the shortcomings of the primary alternative in the early 01990s (ksh/pdksh/bash). But it's also true that lots of Perl-heavy sysadmin shops never got into writing "real programs" in Perl like Slic3r, Perlbal, Movable Type, and Frozen Bubble, and so Perl didn't show up in their job descriptions. And nowadays most of those huge piles of Perl are sort of regrettable, and regretted.