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
0
35
Unit Tests and Mocks: Testing in Python
aylakhan
0
22
Other Decks in Technology
See All in Technology
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
1.7k
多言語化対応における TypeScript の型定義を通して開発のしやすさについて考えた / TSKaigi TypeScript Multilingualization
nabeliwo
2
390
回り回って効いてくる副次的効果としての技術広報/techpr
nishiuma
1
190
Real World Type Puzzle and Code Generation
yukukotani
4
640
開発スピードの維持向上を支える、テスト設計の 漸進的進化への取り組み / Continuous Test Design Development for Speed of Product Development
ropqa
0
180
【SORACOM UG 四国】今だからこそ学ぶ!IoTの全体像と最新事例、生成AIの基礎
soracom
PRO
2
120
テストコードを書きながらCompose Multiplatformを乗りこなす
subroh0508
0
140
株式会社EventHub・エンジニア採用資料
eventhub
0
2.1k
PhpStorm超絶技巧40分集中講義 #phpconkagawa
yusuke
4
780
サービス開発におけるVue3とTypeScriptの親和性について
tsukuha
10
1.8k
本番環境で Cloudflareを 使ってみた話
miu_crescent
2
130
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
12
7.9k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
457
32k
Happy Clients
brianwarren
92
6.4k
For a Future-Friendly Web
brad_frost
172
9k
What’s in a name? Adding method to the madness
productmarketing
PRO
17
2.7k
Making Projects Easy
brettharned
109
5.5k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
What the flash - Photography Introduction
edds
64
11k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
How to name files
jennybc
65
94k
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