FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[NO ISSUE] Adds __eq__ support for non-normalized fractions by nsbruce · Pull Request #103959 · python/cpython · GitHub

/ cpython Public

[NO ISSUE] Adds __eq__ support for non-normalized fractions - #103959

Closed
nsbruce wants to merge 1 commit into
python:mainfrom
nsbruce:main
Closed

[NO ISSUE] Adds __eq__ support for non-normalized fractions#103959
nsbruce wants to merge 1 commit into
python:mainfrom
nsbruce:main

Conversation

nsbruce commented Apr 27, 2023

Copy link
Copy Markdown

If a fraction is created with the _normalize parameter set to false, it fill fail equality checks it should not.

For example before this fix: Fraction(4,2,_normalize=False) != 2.

This PR changes the equality check from just checking that the comparison int equals the numerator to checking that numerator/denominator is equal to the int.

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

ghost commented Apr 27, 2023
edited by ghost
Loading

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

Copy link
Copy Markdown
Contributor

The _normalize parameter is meant for internal use only, as an optimisation for creating objects when we know the numerator and denominator are already normalised. Fraction does not support unnormalised fractions.

Copy link
Copy Markdown
Contributor

In fact, looks like it was removed entirely in #101780

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL