Nvim

Nvim

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?

Most Liked

hauleth

hauleth

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
11
Post #6
peerreynders

peerreynders

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

Phillipp

Phillipp

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.

peerreynders

peerreynders

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

dogweather

dogweather

I stumbled on a surprising instance of Elixir being much easier to learn and use than Python: I was in each one’s REPL, comparing how to do some typical programming task. (I forget exactly, but it might have been JSON parsing.)

The function in each language was easy to call. And in Elixir, the REPL printed out the data structure result, and I could see exactly how it parsed the string.

Python, however, is object-oriented. And so it gave me a single result object. But the author of that class hadn’t written a __str__ method. And so the REPL couldn’t show me the data, and only produced the unhelpful default representation like <JSONResult #12682362>. In order to actually see the result, I’d need to consult the documentation/API and learn what methods I needed to use to extract the info. And then use them precisely as intended, and hope they work as documented. (Sometimes they don’t.)

But at that point, this was an epiphany. I stopped playing with Python and continued using Elixir. In Elixir, your data is simply right there.

Where Next?

Popular in Discussions Top

heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
bartblast
StackOverflow Survey results for 2025 have been published: Gleam - 2nd most admired language Elixir - 3rd most admired language Phoenix...
New
dimitarvp
Hello, I am looking to more closely understand the advantages of the Repo.transact pattern and the quoted disadvantages of Ecto.Multi. ...
New
BigTom
With Phoenix, Liveview, Ash, Oban Web, Nx, Livebook, Beacon, Liveview Native, Flame, Nerves etc all getting mature, are there any major g...
New
sym_num
I created a Forth processor in Elixir. This is my hobby project. https://github.com/sasagawa888/Forth
New
puemos
I’m working on a platform that allows users to add apps and use them in a writing assistant browser extension (https://anycursor.com). C...
New
darkmarmot
At HCA Healthcare (500k employees and contractors), we’re currently experimenting with Elixir for both data integration (to handle parsin...
New
isaacsanders
When I try to run my applications and I haven’t updated the dependencies, the output tells me to run mix deps.get. Why doesn’t the binar...
New
ScriptyScott
Hey Folks, I just spent the last couple of days doing a deep dive into using Swoosh with Amazon’s simple email service, check out this t...
New
PragTob
:wave: I’m currently extracting the statistics calculation part from benchee and stumbled upon how to present error conditions. In the c...
New

Other popular topics Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement