python / python/cpython

Beginner friendly error messages for missing self

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

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

interpreter-core triaged type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Feature or enhancement

Proposal:
>>> class A:
...     def lol(a):
...         print(a)
...
>>> A().lol(1)
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    A().lol(1)
    ~~~~~~~^^^
TypeError: A.lol() takes 1 positional argument but 2 were given

I'd like to request a better experience for this use case.

Has this already been discussed elsewhere?

https://discuss.python.org/t/beginner-friendly-error-messages-for-missing-self-typeerror-a-lol-takes-1-positional-argument-but-2-were-given/107414

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-152326

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

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

はじめの一歩

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

調査の方向性

Issue の A().lol(1) の例から始め、提案されている方向性を理解するために、リンクされたディスカッションと PR gh-152326 を読んでください。プロジェクトがこの self がないことによる TypeError について、初心者にもわかりやすい対応方針に合意し、リンクされた作業が解決されれば完了です。

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

評価

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

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

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