numbers module
Open
Nobody has claimed this yet.
stubs: incomplete
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
The signature of Rational.__truediv__ is marked as the following:
First of, _ComplexLike sounds like it should be numbers.Complex. But second, the signature should be more refined :
- the divisor cannot be just any value, it has to be a number, so at a minimum
numbers.Complexinstead of Unknown. The typing signature should be(self, Complex) -> Complex. - when passing a Real as a divisor, the result cannot have an imaginary part and must be Real too. I'd go as far as saying that a Rational divisor would yield a Rational dividend. In any case, a
(self, Real) -> Realoverload should be defined. And as a bonus, a(self, Rational) -> Rationalone too.
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 at the typeshed numbers module and inspect the declaration of Rational.truediv. Compare its current _ComplexLike and Unknown annotations with the requested Complex, Real, and Rational overloads. Done means the stub expresses the requested divisor and result relationships and passes the relevant typeshed validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100