Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Elixir - a brief intro for pythonistas
Search
Eleni Lixourioti
March 25, 2019
Programming
64
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Elixir - a brief intro for pythonistas
Lightning talk given at Python DBBUG.
Credit on last slide.
Eleni Lixourioti
March 25, 2019
More Decks by Eleni Lixourioti
See All by Eleni Lixourioti
GDPR + Django Model Collector
geekfish
0
250
Intro to Python
geekfish
0
93
Other Decks in Programming
See All in Programming
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.5k
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.6k
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
170
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
610
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
150
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
210
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
180
ふつうのFeature Flag実践入門
irof
8
4.2k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
300
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
130
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
150
A2UI という光を覗いてみる
satohjohn
1
170
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
12k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Ethics towards AI in product and experience design
skipperchong
2
320
Designing Powerful Visuals for Engaging Learning
tmiket
1
430
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
A better future with KSS
kneath
240
18k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Design in an AI World
tapps
1
250
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
440
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
450
Transcript
Elixir a brief intro for pythonistas
Disclaimer...
Elixir
None
Elixir • General Purpose • Dynamic • Functional • "Expressive"
• OTP (Erlang libraries and VM) • interoperability • ! Concurrency !
! Concurrency • EVM processes (not OS processes) • Like
super tiny threads... • ...but no shared state! • Easy to spawn • Actor Model • Supervisors (it's processes all the way down...)
Show me the code
Python def hello(name): print(f"Hello, {name}") Elixir defmodule MyApp.Greetings do def
hello(name) do IO.puts("Hello, #{name}") end end hello("Linda") # Both hello "Linda" # Elixir only ;)
Other familiar things: • Similar data structures (the immutable version)
• Operations, comparisons... • Docstrings • Interactive interpreter • Exception handling (kind of...) • Comprehensions • Unicode support
def update_profile_from_api(url): response = requests.get(url) raw_profile = response.json() profile =
parse_profile(raw_profile) return store(profile) vs def update_profile_from_api(url) do response = HTTPoison.get!(url) raw_profile = Poison.decode!(response.body) profile = parse_profile(raw_profile) store(profile) end
✨ New stuff
Pipes
Pipes def update_profile_from_api(url) do response |> HTTPoison.get! |> Map.get(:body) |>
Poison.decode! |> parse_profile |> store end
Atoms # Standalone: :ok :error # Map keys responses =
%{ :ok => 200 } # instead of %{ "ok" => 200 } responses = %{ ok: 200 } IO.puts(responses.ok)
Many more shiny things • Processes as a core feature
• Macros (make your own DSLs!) • Increasingly evolving package ecosystem (Phoenix, Ecto, Nerves...) • Erlang's mature, battle tested, ecosystem
Is python not enough?
well...
Celery fatigue • Very mature but... • ...the hammer that
fixes everything • Opaque?
Real time? • I want to use all my cores
• Sockets please • The real world is concurrent • The real world has no GIL
Functional Python? • Limited toolset • lambdas are not enough
• second class citizen
Second class citizen? Preventing mutation... def update_a_thing(thing): new_thing = thing.copy()
new_thing.update("foo": "should I use deepcopy instead?") return new_thing
Impromptu pattern-matching-single-dispatch- thing... def render(response): return { 200: _render_succesful, 400:
_render_bad_request, 403: _render_forbidden, 404: _render_not_found, }[response.status](response) def _render_successful(response): return "OK" def _render_bad_request(response): return "Such and such things are wrong: " + response.errors
Elixir def render(%{status: 200}) do "OK" end def render(%{status: 400}
= response) do "Such and such things are wrong: " <> response.error_msg end def render(%{status: 403}) do "The FBI has been dispatched" end def render(%{status: 404}) do "Not Found" end
Python is still great ❤ • But maybe you are
curious about other tools • BONUS: You can use it with Elixir using Erlport
Thank you! • Questions • Read more: https://elixir-lang.org/ https://elixirschool.com/en/ Eleni
Lixourioti
[email protected]
@geekfish_
Credits Icons made by - Smashicons - Flat Icons and
- Freepik from www.flaticon.com, and are licensed CC 3.0 BY