Elixir vs Python

Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?

I don’t think it makes that much sense to compare them as their are very different and they are also used differently. But both can be used for web development, that is for sure.

Python is really strong in the ML/AI stuff, mainly because most of the tooling is written in Python. Probably to keep it very beginner friendly.

5 Likes

@Phillipp I’m comparing just the languages minus the ecosystem.

For what reason? What do you expect from that? They are not even close to each other. It’s like comparing a car to a bicycle.

1 Like

ok thanks for your input. But I’m still waiting for others take on this matter.

Python

Advantages

  • more lightweight VM
  • more broad distribution
  • “easier deployment”
  • broader area of usage (DevOps, Science Computations, scripting, etc.)
  • multiple popular VM implementations (CPython, PyPy, Jython, IronPython, etc.)
  • mutable types

Disadvantages

  • GIL in some implementations
  • distributed computation more complicated
  • mutable types
  • monkey patching (not that it is not possible in Erlang)

Erlang and Elixir

Advantages

  • very good distributed primitives
  • immutable types
  • simple syntax (in case of Erlang)
  • powerful syntax (in case of Elixir)
  • one VM can easily host different languages (Gleam, Elixir, Erlang, LFE, Joxa, Erlog, Luerl, etc.)
  • error handling
  • live updates

Disadvantages

  • immutability
  • without HiPE the performance is often worse than Python
  • less familiar syntax (in case of Erlang)
  • macros can be confusing (in case of Elixir)
  • single popular VM implementation
5 Likes

I think you can’t compare langues without context there are used for.
O’Reilly Radar: Open Source Technology Trends - Roger Magoulas (O’Reilly Media)
OSCON proposals
Text Anastasis of All Sessions Proposals

Next Architecture / Cloud Native
Data
Community
ML/AI
Languages (are only for support role for points above )
2 Likes

It all depends on the context. Project, team, budget etc.

2 Likes

best reply yet to this issue straight to the point.

https://trends.google.com/trends/explore?q=%2Fm%2F07sbkfb,%2Fm%2F02p97,%2Fm%2F05z1_,%2Fm%2F07657k,%2Fm%2F060kv

Python has caught up to Java in terms of popularity. I suspect this is largely due to the fact that typically development in Python is faster than in Java. The fact that it tends to be slower at run-time tends to be a non-issue in most cases.

Python is also easier to learn for non-programmers (while still remaining in the imperative paradigm which many feel is more “natural”) - so it tends to be the weapon of choice of domain experts having to automate stuff (which is what programming essentially is). PHP became popular to “quickly whip up a web site” - Python has a similar appeal to “quickly whip up a program/script”.

(Having said that I suspect that if the JavaScript ecosystem didn’t exist to sink a lot of “developer hate”, Python would be receiving it instead.)

Aside: mozilla.org: Bedrock is a Django Project

Python has positioned itself in the cloud space as a “productive” language - i.e. faster development times than with C, C++, C#, Go, Java, Kotlin etc. (while at the same time not being JavaScript). The tradeoff is that you may require more computational resources at runtime than for a compiled language. Truth is - if your service is profitable enough most businesses don’t care that they could lower the operational cost because they view the gain of efficiency as marginal compared to the perceived cost of (re)development.

For example look at this case:

Summary: Ignore Python at your own peril (try to be a Language Agnostic).

4 Likes

Python is much numerically faster than Elixir and Erlang.

Try doing the Euler challenge. I’ve tried doing a prime number sieve for one of the problem in Erlang and it’s much slower than Python.

But I agree with the other poster. I think you should define what you are trying to solve first and then figure out which of the two languages are best suited for the task.

1 Like

On a node with Xeon Phi (up to 72 cores) I’d much rather use a BEAM language because concurrent programming is much more natural with BEAM processes (I’d assume there is lots of opportunity for concurrency for the task at hand if you are using hardware like that in the first place).

The other extreme is lower-end hardware like what you are likely to encounter in the IoT space because the BEAM creates opportunities in terms getting the most out of your hardware via pre-emptively scheduled concurrent processes and failure resiliency via supervision trees (and possibly redundant (yet still inexpensive) hardware).

3 Likes

It is faster as python is using libraries written in native code.
For example you have https://www.anaconda.com/distribution/

OP stated he didn’t want to talk about libraries so I was referring to just the language themselves.

I’d love to be proven wrong but I’ve done Project Euler in both languages with no libraries. From my experiences and what I’ve read Elixir/Erlang is much slower than Python.

But I do understand your statement about Python’s libraries are implemented in faster language. I’ve use a lot of R libraries and they are implemented in C++ and Fortran mostly. It’s very much a glue language.

1 Like

Truthfully, I see this is an advantage. I come from C and C++. And also from Java and Ruby way before their runtimes were actually as good as they are today. Having multiple community efforts on a runtime/VM was more like a “oh, hell, here we go again” moment once somebody reported a bug. It wasn’t a welcome feature. You had to cater to numerous quirks.

Even Erlang/Elixir’s OTP and Python’s numpy, both very signature technologies, are libraries and not language features or syntax. It’s unimaginable to have Erlang/Elixir without OTP and Python without numpy.

In terms of comparing the languages themselves, I’d say this discussion could just spiral to the imperative/OOP vs. functional languages dispute.

You are correct if there exist a concurrent solution to the problem and there is enough data to overcome the cache latency/cache coherency due to mulitcore then Erlang/Elixir is faster.

For project Euler I only used iterative solutions and project Euler may not be representative of real world problems.

Here Jeremy Howard (fast.ai) discusses python and machine learning.
Actually he wants things to move from python to other languages (Swift) and he don’t think python is great.

Probably there are “network effects” in the play here. Some languages don’t have bigger communities because they are better to work with in my opinion. Big companies also play a role.

For me Elixir feels right, Python don’t. This is my opinion.

1 Like