python / python/typeshed

How important is the `@_dispatchable` decorator in networkx?

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

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

主要言語
Python
スター
5.1k
フォーク
2.1k
平均マージ
1日 19時間
マージ済み PR(30日)
82

説明

Can this decorator be removed?

One obvious advantage for having it is to mirror runtime. It has some disadvantages though:

  1. I can't for the life of me find a way to use it on overloaded functions. Indeed looking at the stubs, overloaded functions are stripped of this decorator
  2. VS Code with Pylance does not show the documentation of the function on hover only when the decorator is used

I find the overload case very important that it outweighs the benefits of matching runtime. I also think the editor hover issue compelling on its own but one could argue that this should be discussed with the Pylance team instead.

I wonder if we could just get rid of the decorator altogether. Am I missing other reasons for having the decorator?

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

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

はじめの一歩

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

調査の方向性

まず、typeshed における @_dispatchable デコレーターの使用箇所を追跡し、stubs 内のオーバーロードされた関数と比較します。runtime-mirroring の根拠と、報告されている Pylance の hover 動作を調査します。デコレーターを残すべきかどうかについて決定し、その決定を文書化または実装できれば完了です。

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

評価

技術スタック
python
領域
developer-experience
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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