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 Hinting and Static Type Checking
Search
ChangHui Lee
August 17, 2019
Programming
0
1.5k
Python Type Hinting and Static Type Checking
ChangHui Lee
August 17, 2019
Tweet
Share
More Decks by ChangHui Lee
See All by ChangHui Lee
RegExp 101
blur
0
210
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
受け取る人から提供する人になるということ
little_rubyist
0
230
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
C++でシェーダを書く
fadis
6
4.1k
CSC509 Lecture 12
javiergs
PRO
0
160
Amazon Qを使ってIaCを触ろう!
maruto
0
400
as(型アサーション)を書く前にできること
marokanatani
8
2.6k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
120
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
600
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
334
57k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Gamification - CAS2011
davidbonilla
80
5k
Bash Introduction
62gerente
608
210k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Building Applications with DynamoDB
mza
90
6.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Transcript
PyCon Korea 2019 ఋੑ Ѩࢎ۽ ؊ ա Python ٘
ࢿೞӝ ହ൞
ߊ blurfx • ࣽୌೱҮ (2014 ~ ) • ֏टܻই (2018.03
~ 2019.07) • ೖಎ٘ஹಌפ (2019.07 ~ )
ॆਸ फযೞח ࢎۈٜ ॆਸ ৵ फযೡөਃ?
None
ఋੑ য ز ఋੑ য
ఋੑ য Writing Code Build Test Run/Deploy য়ܨܳ ߊѼೞח
ҳр
ز ఋੑ য Writing Code Test Run/Deploy য়ܨܳ ߊѼೞח ҳр
ఋੑ Ѩࢎо ޖҊ ೞݶ ޖ જইաਃ?
۽ંо ਵݶ ѐߊ ࣻب Ҋ, ߡӒ ࣻب ݅ icons from
https://icons8.com
۽ંо ਵݶ ѐߊ ࣻب Ҋ, ߡӒ ࣻب ݅ icons from
https://icons8.com ۽ંо ழҊ ѐߊо ݆ইݶ Ӓ ݅ఀ ߡӒب ݆ইפ
۽ંо ਵݶ ѐߊ ࣻب Ҋ, ߡӒ ࣻب ݅ icons from
https://icons8.com ۽ંо ழҊ ѐߊо ݆ইݶ Ӓ ݅ఀ ߡӒب ݆ইפ ز ఋੑ য۽ ࢿೠ ٘ח ۽ંо ழࣻ۾ п ёо যڃ чਸ ঌҊ ח ൨ٜযפ var x ... x ?
Writing Code Static Type Checking Test Run/Deploy ఋੑ ۽
ఋੑী য়ܨо ח Ѩࢎ
٘ оةࢿ ৢۄоҊ ఋੑਵ۽ ߊࢤೡ ࣻ ח ߡӒܳ ߑ೧ਃ
٘ оةࢿ ৢۄоҊ ఋੑਵ۽ ߊࢤೡ ࣻ ח ߡӒܳ ߑ೧ਃ
To Type or Not to Type: Quantifying Detectable Bugs in
JavaScript http://earlbarr.com/publications/typestudy.pdf
http://earlbarr.com/publications/typestudy.pdf To Type or Not to Type
Conclusion: we found that using Flow or TypeScript could have
prevented 15% of the public bugs for public projects on GitHub. http://earlbarr.com/publications/typestudy.pdf To Type or Not to Type
Conclusion: we found that using Flow or TypeScript could have
prevented 15% of the public bugs for public projects on GitHub. http://earlbarr.com/publications/typestudy.pdf To Type or Not to Type
ॆ ز ఋੑ যੋؘ ఋੑਸ যڌѱ ਃ?
Function Annotation Type Annotation Variable Annotation Python 3.0+ Python 3.5+
Python 3.6+
Python 3.6+
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
• ࣻ৬ ޙৌ݅ ೲਊೞח ܻझ • ޙৌ, पࣻ, ࠗ ࣽࢲ۽
ػ ౚ • ޙৌ ః৬ ߄ чਸ о ٤࣊ցܻ • ઁ֎ܼ ೣࣻ৬ ېझ ఋੑ ൦
https://imgflip.com/i/186jmm
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
TypeError: Too many parameters for typing.List; actual 2, expected 1
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
ఋੑ ൦
None
ఋੑ ൦
ఋੑ ൦
None
None
http://blog.daum.net/junjungirl/109
“ no type checking happens at runtime ” — PEP
484
None
mypy mypy ࢸೞӝ
mypy ఋੑ Ѩࢎೞӝ
mypy ఋੑ Ѩࢎೞӝ
mypy ఋੑ Ѩࢎೞӝ
None
Incompatible types in assignment (expression has type "str", variable has
type "int") List item 1 has incompatible type "int"; expected "str" List item 2 has incompatible type "float"; expected "str" Argument 1 to "append" of "list" has incompatible type "bytes"; expected "str"
mypy
mypy
mypy
mypy.readthedocs.io ؊ ࣁೠ ղਊ...
github.com/python/mypy
Q & A
хࢎפ
[email protected]