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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Eleni Lixourioti
March 25, 2019
Programming
0
58
Elixir - a brief intro for pythonistas
Lightning talk given at Python DBBUG.
Credit on last slide.
Eleni Lixourioti
March 25, 2019
Tweet
Share
More Decks by Eleni Lixourioti
See All by Eleni Lixourioti
GDPR + Django Model Collector
geekfish
0
240
Intro to Python
geekfish
0
89
Other Decks in Programming
See All in Programming
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.2k
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.3k
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
490
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
240
[SF Ruby Feb'26] The Silicon Heel
palkan
0
110
encoding/json/v2のUnmarshalはこう変わった:内部実装で見る設計改善
kurakura0916
0
420
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
270
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
120
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
590
AHC061解説
shun_pi
0
380
Featured
See All Featured
Balancing Empowerment & Direction
lara
5
940
What does AI have to do with Human Rights?
axbom
PRO
1
2k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
830
Typedesign – Prime Four
hannesfritz
42
3k
Skip the Path - Find Your Career Trail
mkilby
1
80
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.9k
Context Engineering - Making Every Token Count
addyosmani
9
750
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
63
51k
The Curious Case for Waylosing
cassininazir
0
270
Being A Developer After 40
akosma
91
590k
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