Skip to content
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
Next Next commit
Update number.py from 3.13.7
  • Loading branch information
ShaharNaveh committed Sep 8, 2025
commit 7080a1b57fd58560d0fcb711e33c0f8cde1bde77
11 changes: 10 additions & 1 deletion Lib/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,27 @@ def conjugate(self):


class Rational(Real):
""".numerator and .denominator should be in lowest terms."""
"""To Real, Rational adds numerator and denominator properties.

The numerator and denominator values should be in lowest terms,
with a positive denominator.
"""

__slots__ = ()

@property
@abstractmethod
def numerator(self):
"""The numerator of a rational number in lowest terms."""
raise NotImplementedError

@property
@abstractmethod
def denominator(self):
"""The denominator of a rational number in lowest terms.

This denominator should be positive.
"""
raise NotImplementedError

# Concrete implementation of Real's conversion to float.
Expand Down