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
200
Other Decks in Programming
See All in Programming
データサイエンスのフルサイクル開発を実現する機械学習パイプライン
xcnkx
2
490
DjangoNinjaで高速なAPI開発を実現する
masaya00
0
490
ポケモンで考えるコミュニケーション / Communication Lessons from Pokémon
mackey0225
4
160
XP2024 っていう国際会議に行ってきたよの記 / XP2024 Conference Report
bonotake
4
200
標準ライブラリの動向とイテレータのパフォーマンス
makki_d
3
190
2024-10-01 dev2next - Observability for Modern JVM Applications
jonatan_ivanov
0
100
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
1.4k
実践Dash - 手を抜きながら本気で作るデータApplicationの基本と応用 / Dash for Python and Baseball
shinyorke
2
250
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
6
660
文化が生産性を作る
jimpei
3
540
ビット演算の話 / Let's play with bit operations
kaityo256
PRO
4
170
Compose Multiplatform과 Ktor로 플랫폼의 경계를 넘어보자
kwakeuijin
0
250
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
519
39k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
Done Done
chrislema
181
16k
Robots, Beer and Maslow
schacon
PRO
157
8.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
6
260
How GitHub Uses GitHub to Build GitHub
holman
473
290k
10 Git Anti Patterns You Should be Aware of
lemiorhan
653
59k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
A designer walks into a library…
pauljervisheath
201
24k
Become a Pro
speakerdeck
PRO
24
4.9k
Large-scale JavaScript Application Architecture
addyosmani
509
110k
Documentation Writing (for coders)
carmenintech
65
4.3k
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]