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
36
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
18
Productive Bash
aylakhan
1
37
Unit Tests and Mocks: Testing in Python
aylakhan
0
22
Other Decks in Technology
See All in Technology
なぜfreeeはハブ・アンド・スポーク型の データメッシュアーキテクチャにチャレンジするのか?
shinichiro_joya
2
770
embedパッケージを深掘りする / Deep Dive into embed Package in Go
task4233
1
220
カップ麺の待ち時間(3分)でわかるPartyRockアップデート
ryutakondo
0
160
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
3
1.2k
AWS re:Invent 2024 recap in 20min / JAWSUG 千葉 2025.1.14
shimy
1
110
第27回クラウド女子会 ~re:Invent 振り返りLT会~ 私の周辺で反響のあった re:Invent 2024 アップデートつれづれ/reinvent-2024-update-reverberated-around-me
emiki
1
430
FinJAWS_reinvent2024_recap_database
asahihidehiko
2
190
Site Reliability Engineering on Kubernetes
nwiizo
4
420
20250116_自部署内でAmazon Nova体験会をやってみた話
riz3f7
1
130
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
120
「人物ごとのアルバム」の精度改善の軌跡/Improving accuracy of albums by person
mixi_engineers
PRO
2
150
AIアプリケーション開発でAzure AI Searchを使いこなすためには
isidaitc
1
150
Featured
See All Featured
The Language of Interfaces
destraynor
156
24k
The Invisible Side of Design
smashingmag
299
50k
Designing for humans not robots
tammielis
250
25k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Building Your Own Lightsaber
phodgson
104
6.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
A Philosophy of Restraint
colly
203
16k
Designing on Purpose - Digital PM Summit 2013
jponch
117
7.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Faster Mobile Websites
deanohume
305
30k
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