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
フロントエンドカンファレンス北海道2024 『小規模サイトでも使えるVite 〜HTMLコーディングをよりスマートに〜』長谷川広武(ハム)
h2ham
1
2.5k
Swiftコードバトル必勝法
toshi0383
0
150
ゲームボーイアドバンスでSwiftを動かそう
k_koheyi
0
520
BasicBasic認証
sadnessojisan
5
2.7k
ESLint Rule により事業, 技術ドメインに沿った制約と誓約を敷衍させるアプローチのすゝめ
shinyaigeek
1
2.8k
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
120
快適な開発と高セキュリティを実現するCryptoKitを活用したCoreDataのデータ暗号化術
grandbig
1
310
Meet BrowserEngineKit
swiftty
0
260
これからの時代の新標準!SwiftTestingへの移行とトラブルシューティング
uetyo
0
460
Appleの新しいプライバシー要件対応: ノーコードアプリ プラットフォームの実践事例
nao_randd
1
460
RAGの回答精度評価用のQAデータセットを生成AIに作らせた話
kurahara
0
220
月間4.5億回再生を超える大規模サービス TVer iOSアプリのリアーキテクチャ戦略 - iOSDC2024
techtver
PRO
1
620
Featured
See All Featured
KATA
mclloyd
27
13k
Infographics Made Easy
chrislema
239
18k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
28
2.2k
Why Our Code Smells
bkeepers
PRO
334
56k
The World Runs on Bad Software
bkeepers
PRO
64
11k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
325
21k
[RailsConf 2023] Rails as a piece of cake
palkan
44
4.6k
Producing Creativity
orderedlist
PRO
340
39k
Pencils Down: Stop Designing & Start Developing
hursman
118
11k
Designing on Purpose - Digital PM Summit 2013
jponch
113
6.8k
Designing with Data
zakiwarfel
98
5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
165
48k
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]