Beginner friendly error messages for missing self
Open
Nobody has claimed this yet.
interpreter-core
triaged
type-feature
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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?
Links to previous discussion of this feature:
No response
Linked PRs
- gh-152326
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the A().lol(1) example in the issue, then read the linked discussion and PR gh-152326 to understand the proposed direction. Done means the project has an agreed beginner-friendly treatment for this missing-self TypeError and the linked work is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100