python / python/typing

Handle special object NotImplemented like type (like it done for None)

Open
#742 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: feature
Dominant language
Python
Stars
1.8k
Forks
302
Avg merge
23h
Merged PRs (30d)
8

Description

Currently incorrect, but useful to be supported:

def fun() -> Union[bool, NotImplemented]: ...

This will better explain expected, than:

def fun() -> Union[bool, Any]: ...

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by reviewing how the project currently handles None as a special object in type expressions. Compare that behavior with the proposed Union[bool, NotImplemented] example and determine the typing semantics needed; done means NotImplemented is supported in the intended type position and communicates the expected return possibility more precisely than Any.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.