by CoreyFieldens · 3y ago · 0 comments
Python is the de facto but it's so slow for anything that can't be well represented as vectorized NumPy operations. There are ways around that like Numba, Jax, Cython, etc. but their use cases are pretty limited, and they don't work well with other Python packages.
There is, of course, C and C++ which are commonly used to speed up Python or as standalone packages. However, C++ is such a complicated beast that writing performant and correct code takes forever. C is much more manageable, but I find that there are not a lot of scientific packages written in pure C. This isn't even touching on the horrendous build system that is CMake.
Fortran is a pretty simple looking language and would probably be the closest to Julia in terms of speed and expressiveness, but the writing is on the wall and Fortran's days are numbered. I am not aware of many new packages being developed using it.
Other than that, there's languages like Rust and Go but those have ecosystems that are so small, they make Julia's ecosystem look like Python's. I really don't want to spend my time as a grad student writing basic numerical libraries from scratch.
Nothing could be further from the truth. Fortran, both the language itself and the packages in the ecosystem, is continually developed. There are a few peer-reviewed studies that quantitatively tracked Fortran usages and concluded that Fortran is not just for legacy code -- people actually continue to write new packages precisely for the reasons you mentioned (expressivity, performance)
"Modern Fortran" book would be one way of doing it,
Same goes with Perl - probably more Perl developers than at its heyday in the 90s but a smaller chunk of the overall picture. Measure by noise levels and anything that doesn't explode seems to be dying.
I'm sure people will become more critical of Julia if it successfully becomes the de facto for those things but there's a big difference in that Julia is very focused on those things whereas Python is trying to be as general purpose as possible
I really don't see a place for Python
ml --> Julia, C++, R
dataviz --> R, JS/TS
beginner-friendly --> JS
web --> JS
want a backend framework but wanna choose a language that's easy to hire for --> TS, Ruby
huge, stable community --> JS/TS
quick scripts --> Deno
systems --> Rust, C++, Java, Go
I'd say it still dominates in scripting/webscraping and creating shareable work (e.g. Jupyter), but I'm just pointing out that at this point it's replaceable in those areasI agree. Around 2008, I was drunk on "the zen of Python", considering myself a Pythonista, writing elegant solutions, making unmaintainable one liners etc. But really Lisp was so much better for that power/speed of development. Eventually (for me) go was so much more powerful, easy to maintain etc. with actual industry usage (seemingly instantly) without any loss in productivity.
Python solutions seem no better than maligned JS solutions nowadays - but at least there's TS and efforts to improve it where they can. Indeed, most Python code doesn't seem to be in proper production, but just one of exploratory scripts and pieces strewn about in notebooks. It seems like it could easily lose market share quite quickly.
Python's advantage is apart from web-frontend (I have no expectation PyScript will catch on), it is everywhere, even when you don't expect it to be (e.g. Bank Python, VFX, Postgres, build systems, scripting interfaces in apps). Are there better options for specific usecases? Yes, but it's when these usecases intersect that Python wins out.
You mention Julia/C++/R for ML. My counterargument would be that things like fast.ai exist, use Python and make the whole topic approachable. I also find it a bit hard to belive many people that don't come from a stats/other academic field background would readily pick R over Python for anything ML related. I personally never thought JS was very beginner friendly because setup was traditionally clunky. That has thankfully changed a lot.
You mention many things that are better in theory but in practice I need to get work done now. I'd probably rather write quick scripts in Python (or bash) than Deno for example.
It's probably also easier to hire for Python than Ruby at least I'm not convinced Ruby has a giant edge. Huge, stable community is also exactly what Python has.
Python also has mindshare in many niches for example in security many things are quickly scripted in Python (notoriously Python 2 in some cases). Go and Ruby are also used for a lot of tooling there.
At the end of the day, if someone from a non-programming background asks me what language to learn, I still recommend Python (because usually they either want to pivot into ML somehow or want to get some quick scripting done to automate something or want to scrape some data). If I were to teach my child, I'd probably pick what I consider the most fun and completely ignore employability (Elixir) and if I were to build a CS program from sratch I'd have to think long and hard. I might end on Rust or Go but JS would be in the running (depends if there's a big focus on embedded/osdev etc.).
At the end of the day, "pick whatever language gets the job done" is still the best recommendation in my opinion :)
I get thinking Python and JS are "kind of the same", but there are so many details that Python gets right and JS kinda falls apart on. Python's pervasive dunder methods means that you can look at objects in a REPL and get a good representation (try looking at any non-trivial Javascript object and it's a major pain). You can define equality. Operations _don't_ stringify by default (so dictionaries work like you think they should). And Python has blocking methods, which means that you can write code in a straightforward way.
There are a lot of things playing in JS's favor but especially as packaging stories get better it's hard to discount Python's ease of use relative to Javascript IMO. And all of this is kind of ignoring the fact that most people are _actually_ talking about Typescript when they talk about JS nowadays, because writing "raw" JS is so error prone that it would be very difficult to actually get serious work done in it without an extra lint phase (I say this as a huge TS proponent)
ml --> Python
dataviz --> Python
beginner-friendly --> Python
web --> JS
want a backend framework but wanna choose a language that's easy to hire for --> Python
huge, stable community --> Python
quick scripts --> Python
high level system --> Python
low level systems --> Rust, C/C++Beginner friendly -> Python
Then use for ml, dataviz, huge community, quick scripts, backend
Your migration doesn’t do that and I’d argue that JS isn’t as good as Python for a lot of those use cases anyway.
IMO the main problem is pedagogical. JS is a vast sea of conveniences that contradict conventional programming practices. This is also the reason I hesitate to recommend R as a starting language, for all that it's the de facto language of statistical analysis. Both languages are hard to teach in a coherent way, because both have lots of gotchas and exceptions that aren't bad, per se, but in the aggregate impede understanding of fundamentals.
Just yesterday I was working with someone on fundamentals in R, distinguishing between literals, variables, and functions. He got the idea, and then we got to model specification (`lm(y ~ x)`) and I had to shrug and say, those "identifiers" are different. I shudder to think of trying to teach types with a beginning student in JS.
I see that as more of a point in Python's favour than Julia's. IME languages that are designed as general-purpose languages tend to be better than languages that are designed for niche purposes, even within those niches. The things that make a language good require consistent, general thinking.
They've been saying this since the late 1980s. Not that I think it's particularly lively, mind.
From "The Handbook of Computers and Computing", by Arthur H. Seidman and Ivan Flores, 1984, https://archive.org/details/handbookofcomput00seid/page/342/... :
> For many years, it has been popular to predict that FORTRAN soon will be a dead language, to be replaced by a "better" language. Despite the undeniable fact that there are more eloquent, rich and powerful languages available, FORTRAN continues to be used widely and, indeed, is still the most popular programming language for scientific and engineering applications.
From NASA Conference Publication 2055, Engineering and Scientific Data Management, 1978,https://archive.org/details/NASA_NTRS_Archive_19780025833/pa...
> Margaret White: ... I know FORTRAN is essentially a dead language, but there is a lot of FORTRAN around. Would you care to respond?
> Jim Browne: Is there anyone from IBM who would care to respond? The microphone is yours. Who is it? How many times has FORTRAN been buried?
I am mostly indifferent to the language (love the Jupyter equivalent tool Pluto, dislike Pkg, love the simplicity of matrix operations, dislike being pushed towards the REPL...) - I am increasingly irked by the observation that in topics like this the Julia community comes out in force to downvote anyone who expresses a negative opinion.
I’ve always found Matlab the language to be small and simple, with just a few oddities. The library is where most of the warts accumulated, but I’ve used it long enough to learn them. Performance is much better than python - very fast matrix operations and Java-like speeds for everything else, with comparable startup times.
Main argument against that is probably that it's possible to get the same sort of codegen out of C++ and fortran native programmers are somewhat scarce, though I'd bet on it being easier to teach to domain people than julia or c++.
(disclaimer: I've used neither of them)
I see what you did there.
And, yes, for math-y stuff that you are going to be reading off a book, it helps keep things more compatible.
If Julia had evolved into a community-managed language in the same way that Python has, I would have a positive outlook on it - but I am nervous about the efforts to commercialise it (which mostly just seems to be a case of skimming value off of financial institutions). It is totally understandable why the creators went down this route, but I just wish they had been more idealistic rather than getting on the "everything is a VC-backed company" bandwagon. While I hope Julia continues to grow, I don't trust its longevity enough to put serious effort into using it for myself.
Google owning Go is a big downside, but I think people know that going in - also, Google makes no attempt to monetize the language.