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
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
Recoilを剥がしている話
kirik
5
6.6k
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
300
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
useSyncExternalStoreを使いまくる
ssssota
6
1k
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
700
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
命名をリントする
chiroruxx
1
390
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
44
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Designing for humans not robots
tammielis
250
25k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Facilitating Awesome Meetings
lara
50
6.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Being A Developer After 40
akosma
87
590k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Mobile First: as difficult as doing things right
swwweet
222
9k
Music & Morning Musume
bryan
46
6.2k
No one is an island. Learnings from fostering a developers community.
thoeni
19
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]