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
68
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
260
Intro to Python
geekfish
0
94
Other Decks in Programming
See All in Programming
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
210
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
1
2k
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
600
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
150
源内ハンズオン概要編
hideg
0
210
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
2
440
Oxlintはいいぞ(続)
yug1224
1
460
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
160
AIの中の人になってみる
htkym
0
120
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
510
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
510
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
720
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Making Projects Easy
brettharned
120
6.7k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
630
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
The Spectacular Lies of Maps
axbom
PRO
1
940
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
180
HDC tutorial
michielstock
2
820
Building AI with AI
inesmontani
PRO
1
1.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
550
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
360
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