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
41
0
Share
Python Type Hints
PyLadies lightning talk about Python type hints
Ayla Khan
May 16, 2018
More Decks by Ayla Khan
See All by Ayla Khan
Getting started with docker + python
aylakhan
0
21
Productive Bash
aylakhan
1
40
Unit Tests and Mocks: Testing in Python
aylakhan
0
29
Other Decks in Technology
See All in Technology
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
4
600
システムは「動く」だけでは 足りない - 非機能要件・分散システム・トレードオフの基礎
nwiizo
29
9.2k
The Journey of Box Building
tagomoris
4
220
Azure Static Web Apps の自動ビルドがタイムアウトしやすくなった状況に対応した件/global-azure2026
thara0402
0
320
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
16k
サイバーフィジカル社会とは何か / What Is a Cyber-Physical Society?
ks91
PRO
0
200
NgRx SignalStore: The Power of Extensibility
rainerhahnekamp
0
230
Data Hubグループ 紹介資料
sansan33
PRO
0
2.9k
Amazon S3 Filesについて
yama3133
2
140
Discordでリモートポケカしてたら、なぜかDOを25分間動かせるようになった話
umireon
0
140
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
490
え!?初参加で 300冊以上 も頒布!? これは大成功!そのはずなのに わいの財布は 赤字 の件
hellohazime
0
150
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
A designer walks into a library…
pauljervisheath
211
24k
Done Done
chrislema
186
16k
Side Projects
sachag
455
43k
Paper Plane
katiecoart
PRO
1
49k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
140
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
190
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
A better future with KSS
kneath
240
18k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
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