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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ayla Khan
May 16, 2018
Technology
0
40
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
20
Productive Bash
aylakhan
1
40
Unit Tests and Mocks: Testing in Python
aylakhan
0
28
Other Decks in Technology
See All in Technology
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
ClickHouseはどのように大規模データを活用したAIエージェントを全社展開しているのか
mikimatsumoto
0
200
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
Kiro IDEのドキュメントを全部読んだので地味だけどちょっと嬉しい機能を紹介する
khmoryz
0
170
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
0
810
プロポーザルに込める段取り八分
shoheimitani
1
180
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
120
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
Digitization部 紹介資料
sansan33
PRO
1
6.8k
(金融庁共催)第4回金融データ活用チャレンジ勉強会資料
takumimukaiyama
0
140
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
How to Talk to Developers About Accessibility
jct
2
130
Scaling GitHub
holman
464
140k
New Earth Scene 8
popppiees
1
1.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
The untapped power of vector embeddings
frankvandijk
1
1.6k
Designing for Performance
lara
610
70k
Navigating Weather and Climate Data
rabernat
0
100
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Odyssey Design
rkendrick25
PRO
1
490
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
240
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
49
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