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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ChangHui Lee
August 17, 2019
Programming
1.7k
0
Share
Python Type Hinting and Static Type Checking
ChangHui Lee
August 17, 2019
More Decks by ChangHui Lee
See All by ChangHui Lee
RegExp 101
blur
0
230
Other Decks in Programming
See All in Programming
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
120
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
660
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
1.3k
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
3
1.4k
関係性から理解する"同一性"の型用語たち
pvcresin
2
630
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
2
400
Modding RubyKaigi for Myself
yui_knk
0
860
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
210
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
160
Claspは野良GASの夢をみるか
takter00
0
150
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
3k
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
140
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
310
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
300
A Tale of Four Properties
chriscoyier
163
24k
Become a Pro
speakerdeck
PRO
31
6k
So, you think you're a good person
axbom
PRO
2
2k
Typedesign – Prime Four
hannesfritz
42
3.1k
Google's AI Overviews - The New Search
badams
0
1k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
840
The Curious Case for Waylosing
cassininazir
1
370
Believing is Seeing
oripsolob
1
140
WENDY [Excerpt]
tessaabrams
11
38k
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]