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
Python Type Hints
Search
Ayla Khan
May 16, 2018
Technology
0
38
Python Type Hints
PyLadies lightning talk about Python type hints
Ayla Khan
May 16, 2018
Tweet
Share
More Decks by Ayla Khan
See All by Ayla Khan
Getting started with docker + python
aylakhan
0
19
Productive Bash
aylakhan
1
38
Unit Tests and Mocks: Testing in Python
aylakhan
0
23
Other Decks in Technology
See All in Technology
動画データのポテンシャルを引き出す! Databricks と AI活用への奮闘記(現在進行形)
databricksjapan
0
160
o11yで育てる、強い内製開発組織
_awache
3
120
PLaMo2シリーズのvLLM実装 / PFN LLM セミナー
pfn
PRO
2
1k
小学4年生夏休みの自由研究「ぼくと Copilot エージェント」
taichinakamura
0
510
やる気のない自分との向き合い方/How to Deal with Your Unmotivated Self
sanogemaru
0
110
Why Governance Matters: The Key to Reducing Risk Without Slowing Down
sarahjwells
0
120
綺麗なデータマートをつくろう_データ整備を前向きに考える会 / Let's create clean data mart
brainpadpr
2
300
AI時代だからこそ考える、僕らが本当につくりたいスクラムチーム / A Scrum Team we really want to create in this AI era
takaking22
7
3.8k
20201008_ファインディ_品質意識を育てる役目は人かAIか___2_.pdf
findy_eventslides
2
540
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
9.1k
ガバメントクラウドの概要と自治体事例(名古屋市)
techniczna
1
150
pprof vs runtime/trace (FlightRecorder)
task4233
0
170
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
5
210
Embracing the Ebb and Flow
colly
88
4.8k
Thoughts on Productivity
jonyablonski
70
4.9k
The Cost Of JavaScript in 2023
addyosmani
53
9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
Designing for Performance
lara
610
69k
Gamification - CAS2011
davidbonilla
81
5.5k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
189
55k
YesSQL, Process and Tooling at Scale
rocio
173
14k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
53k
Transcript
Python (3.5+) Type Hints Using Type Aliases
What Are Python Type Hints? • New in 3.5 (provisional)
• PEP484 • Optional (not enforced at runtime) ◦ Linter use recommended instead • Function annotations • Type Aliases, NewType, Callable, Generics ...
Type Alias
Type Alias Linting
Type Alias At Runtime
Type Alias
Type Alias At Runtime
Type Alias
Type Alias
Type Alias (Any type, implicit)
Type Alias (Any type, implicit)
Type Hints Advantages • Clarifies, “enforces” intent • Improves readability
◦ Simplifies type signatures • Improves testability • May prevent bugs
Type Hints Disadvantages • Lose dynamic typing flexibility • Syntax
complexity