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

jdumont
I could write forever about this, but I’ll do my best to keep it succinct. For anyone familiar with event sourcing, what is your opinion...
New
krainboltgreene
Today I noticed that when defining a embeds_many the new struct has a default of [] which is confusing since: You can have jsonb[] colu...
New
christopheradams
I was recently asked to step up and become the maintainer for the Elixir Style Guide. It was, I believe, the first, and is now the most p...
New
bartblast
Hologram provides a way to write your entire web application in Elixir, with automatic transpilation to JavaScript for the frontend. It h...
New
thiagomajesk
I came across this PKGX tool the other day, if anyone here is using it, could you share your experience? I’m wondering how useful it wou...
New
derpycoder
So, anyone got a chance to look at this?!? I’m kind of glad this came along. We can just throw this into our Auth pages and won’t have t...
New
Crowdhailer
It is rare to use direct calls to send in elixir. The call is normally wrapped in a function which is responsible for sending the correct...
New
ronindev
Hey everyone! :waving_hand: I just wanted to recommend https://seenode.com/ for deploying Phoenix apps. I’ve been using it recently and ...
New
chrisliaw
Hi, I’m wondering is it my thinking process or this is the norm among the Elixir developer for the use of Struct and accessor functions ...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

Other popular topics Top

vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement