PyCon JP 2020 の「Python 3.9 時代の型安全な Python の極め方」の発表資料です
皆さん、普段 Python でコードを書くときはちゃんと型を書いてますよね? まだ型の書き方を知らない場合は Software Design 2020年 5月号の『Python でも型チェックしよう』を読むといいと思いますよ (宣伝)。 レビューのお手伝いをした『Python でも型チェックしよう』(by @t2y)が掲載されているSDが発売されました。型ヒントを使ってみたい方におすすめです。また、3.8で導入された Protocolなども紹介されており、すでに使っている方にもお勧め! / Software Design 2020年5月号 https://t.co/JL5GgO0mcq — tk0miya (@tk0miya) April 18, 2020 私はコードに型をつけ始めておおよそ 3年ぐらいになるのですが、いまでは型がないと落ち着かなくなっています。 コード規模がある程度大きく
mypy は Python の型アノテーションを元に静的な型チェックを行うライブラリ。型推論を行い返り値の型などもチェックする。 Pythonではじまる、型のある世界 - Qiita mypyやっていくぞ - Qiita [翻訳] Python の静的型、すごい mypy! - Qiita 起動からアルゴリズム部分に到達するまで mypy コマンドは scripts/mypy が起動される main.py の main mypy.build.build が呼ばれる dispatch メソッドが色々やってそう 全体の流れ build.py の中にアルゴリズムや設計思想がテキストで説明してある dispatch は ① load_graph(source) して ② process_graph(graph) する load_graph Graph とは str->State の dict St
Jukka Lehtosalo is a Finnish Software Engineer at Dropbox. He developed an optional type system for Python, mypy, during his PhD thesis in Cambridge. After meeting in a Python conference, Guido van Rossum (creator of Python) invited Lehtosalo to join him at Dropbox. They started adopting mypy in real use cases during a Hackathon, which led to mypy being one of the most popular Python type checkers
Python Types Intro¶ Python has support for optional "type hints" (also called "type annotations"). These "type hints" or annotations are a special syntax that allow declaring the type of a variable. By declaring types for your variables, editors and tools can give you better support. This is just a quick tutorial / refresher about Python type hints. It covers only the minimum necessary to use them
めちゃくちゃ長いですが 変数や属性に代入されるオブジェクトの型名を書く という、ただそれだけの話です。 # 1. はじめに 型ヒントの書き方については mypy のマニュアルにチートシートがありました。 わかる方は、直接こちらをご参照ください。 Type hints cheat sheet (Python 3) - mypy (opens new window) また型ヒントをいつ使うのか、と言った 「使い分け」 、型ヒントが登場した 「背景」 については、 以下の記事にまとめました。本記事の後編にあたります。 動的言語と静的言語ってなに? この記事では主に 「書き方」 と 「使い方」 について、書いていきます。 # 1.1. 型ヒント 変数に代入される型の名前です。 正確には違います。引用先の用語集をご参照ください。
mypyc: Mypy to Python C Extension Compiler NOTE: We are in the process of moving the mypyc README to the mypyc repository This may be out of date! Mypyc is a compiler that compiles mypy-annotated, statically typed Python modules into CPython C extensions. Currently our primary focus is on making mypy faster through compilation -- the default mypy wheels are compiled with mypyc. Compiled mypy is ab
Dropbox は、Python のビッグ ユーザーです。Python は、バックエンド サービスとデスクトップ クライアント アプリの両方で最も広く使用されています(Dropbox は Go、TypeScript、Rust のヘビー ユーザーでもあります)。 Dropbox の Python コードは数百万行にも及ぶ規模となっていますが、その動的型付けによってコードが必要以上に理解しにくくなり、生産性に深刻な影響を与えるようになりました。 これを軽減するため、現在私たちは最も普及している Python スタンドアロン型チェッカー、mypy による静的型チェックにコードを徐々に移行しています(mypy はオープン ソース プロジェクトであり、そのコア チームは Dropbox 内に設立されました)。 Dropbox は、この規模での Python 静的型チェックを導入した最初の企業の一つで
Dropbox is a big user of Python. It’s our most widely used language both for backend services and the desktop client app (we are also heavy users of Go, TypeScript, and Rust). At our scale—millions of lines of Python—the dynamic typing in Python made code needlessly hard to understand and started to seriously impact productivity. To mitigate this, we have been gradually migrating our code to stati
One of the main selling points for Python is that it is dynamically-typed. There is no plan to change this. Nevertheless, in September 2014 Guido van Rossum (Python BDFL) created a python enhancement proposal (PEP-484) to add type hints to Python. It has been released for general usage a year later, in September 2015, as part of Python 3.5.0. Twenty-five years into its existence now there was a st
Watch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Python Type Checking In this guide, you will get a look into Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit way. Recent versions of Python allow you to specify explicit type h
This article brought to you by LWN subscribersSubscribers to LWN.net made this article — and everything that surrounds it — possible. If you appreciate our content, please buy a subscription and make the next set of articles possible. One of the larger features added to Python over the last few releases is support for static typing in the language. Static type-checking and tools to support it show
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く