8000 `Fraction.__new__` now accepts anything with `.as_integer_ratio()` by InSyncWithFoo · Pull Request #12994 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Fraction.__new__ now accepts anything with .as_integer_ratio() #12994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update stdlib/fractions.pyi
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
InSyncWithFoo and AlexWaygood authored Nov 12, 2024
commit c44d96d92bea72001ac28211f95788c74947eb43
6 changes: 3 additions & 3 deletions stdlib/fractions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ else:
@overload
def gcd(a: Integral, b: Integral) -> Integral: ...

_IR = TypeVar("_IR", covariant=True)
_R_co = TypeVar("_R_co", covariant=True)

class _ConvertibleToIntegerRatio(Protocol[_IR]):
def as_integer_ratio(self) -> _IR: ...
class _ConvertibleToIntegerRatio(Protocol[_R_co]):
def as_integer_ratio(self) -> _R_co: ...

class Fraction(Rational):
@overload
Expand Down
Loading
0