python / python/typing

[spec] Overload processing order

オープン
#1,803 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

topic: typing spec
主要言語
Python
スター
1.8k
フォーク
302
平均マージ
23時間
マージ済み PR(30日)
8

説明

It's my understanding that overloads are processed in order. I.e. given the following overloads:

@overload
def foo(x: int) -> None: ...
@overload
def foo(x: int | str) -> None: ...
@overload
def foo(x: str) -> None: ...

When called with an int, the first overload is matched, when called with a str, the second is matched. The third is never matched. (Not going into what happens when called with int | str.) Currently, this behavior is not mentioned in the spec.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、オーバーロード解決について説明している typing specification のセクションを見つけ、現在の文言を issue にある順序依存の例と比較してください。作業は、specification がオーバーロードを順序どおりに処理する方法を明確に示し、提示された int と str のケースを説明した時点で完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。