You don't need to raise NotImplementedError for abstract methods

Open
#100,400 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
documentation

Research direction

Start with the cited section in Doc/library/exceptions.rst and read the surrounding NotImplementedError documentation. Confirm how the text describes abstract methods and ABCs, then update the documentation so its guidance matches the behavior described in the issue. Done means the relevant documentation is accurate and consistent with the standard-library ABC behavior.

Written by the indexing model from the issue text.

Description

docs

Documentation

In the documentation for NotImplementedError, we see the following:

https://github.com/python/cpython/blob/a7715ccfba5b86ab09f86ec56ac3755c93b46b48/Doc/library/exceptions.rst?plain=1#L299-L304

If "abstract base classes" are meant to mean ABCs from the standard library, this is unnecessary as the ABC metaclass will prohibit instantiation of any derived class that doesn't implement an abstract method. Indeed, adding a raise would be dead code that would flaunt, say, coverage metrics.

Dominant language
Python
Stars
77.2k
Forks
36k
Avg merge
1d 9h
Merged PRs (30d)
558

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python/cpython

All issues in python/cpython

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.