Elixir has some features I wish Python had: - atoms - everything (or most things) is a macro, even def, etc. - pipes |>, and no, I don't want to write a "pipe" class in Python to use it like pipe(foo, bar, ...). 90% of the |> power comes from its 'flow' programming style. - true immutability - true parallelism and concurrency thanks to the supervision trees - hot code reloading (you recompile the app WHILE it's runni…
Mix is also so much better than anything python has to offer in terms of build/dependency tooling.
Embedding Python in Elixir, it's fine
21–30 of 66 posts
Re: Embedding Python in Elixir, it's fine
#22Re: Embedding Python in Elixir, it's fine
#23Really glad to see this, Elixir has languished in the AI wars despite being a better fit than JavaScript and Python.
Forgive some ignorance on this; why is Elixir a better fit for AI than Python or JavaScript? I'm not disagreeing, I've just never heard that, I didn't think that Elixir had good linear algebra libraries like NumPy.
Re: Embedding Python in Elixir, it's fine
#24Earlier quoted context omitted.
Mix is also so much better than anything python has to offer in terms of build/dependency tooling.
uv for Python is a game changer, better than anything else out there and solves a lot of the core problems with pip/venv/poetry/pyenv (the list goes on).
Re: Embedding Python in Elixir, it's fine
#25Earlier quoted context omitted.
uv for Python is a game changer, better than anything else out there and solves a lot of the core problems with pip/venv/poetry/pyenv (the list goes on).
I feel like you can write some variant of this comment every few years and just add the previous "best" to the front of the stack of things it's better than.
Re: Embedding Python in Elixir, it's fine
#26Re: Embedding Python in Elixir, it's fine
#27Elixir has some features I wish Python had: - atoms - everything (or most things) is a macro, even def, etc. - pipes |>, and no, I don't want to write a "pipe" class in Python to use it like pipe(foo, bar, ...). 90% of the |> power comes from its 'flow' programming style. - true immutability - true parallelism and concurrency thanks to the supervision trees - hot code reloading (you recompile the app WHILE it's runni…
So one could write
class Piped:
def __init__(self, value):
self.value = value
def __or__(self, func):
return Piped(func(self.value))
def __repr__(self):
return f"Piped({self.value!r})"
Piped('test') | str.upper | (lambda x: x.replace('T', 't')) | "prefix_".__add__ # => prefix_tESt
but whether that is a good idea is a whole different matter.Re: Embedding Python in Elixir, it's fine
#28Elixir is just Lisp with a facelift[1], and lisps can be built on Python[2]. It stands to reason that an elixir-like can be built on Python too, so you could embed the Python runtime in Elixir but Elixir-likes are used to code for both. 1: https://wiki.alopex.li/ElixirForCynicalCurmudgeons 2: https://hylang.org/
Could be better, but that is what mainstream gets.
Re: Embedding Python in Elixir, it's fine
#29Really glad to see this, Elixir has languished in the AI wars despite being a better fit than JavaScript and Python.
Forgive some ignorance on this; why is Elixir a better fit for AI than Python or JavaScript? I'm not disagreeing, I've just never heard that, I didn't think that Elixir had good linear algebra libraries like NumPy.
Re: Embedding Python in Elixir, it's fine
#30For Livebook, this looks really cool. Love that it calls CPython directly via C++ NIFS in Elixir and returns Elixir-native data structures. That's a lot cleaner than interacting with Python in Elixir via Ports, which is essentially executing a `python` command under the hood. For production servers, Pythonx is a bit more risky (and the developers aren't claiming it's the right tool for this use case). Because it's ru…
This is what we use at https://transport.data.gouv.fr/ (the French National Access Point for transportation data - more background at https://elixir-lang.org/blog/2021/11/10/embracing-open-data-...).
Note that we're not using Pythonx, but running some memory hungry processes which can sometime take the worker node down.