(original) (raw)

If anyone cares, my vote is to rip out both .as\_integer\_ratio() and .is\_integer() from Python. I've never used either and wouldn't want to.

Both seem like perfectly good functions for the \`math\` module, albeit the former is simply the Fraction() constructor.

I can see no sane reason why anyone would ever call float.is\_integer() actually. That should always be spelled math.isclose(x, int(x)) because IEEE-754\. Attractive nuisance is probably too generous, I'd simply call the method a bug.

On Mon, Mar 12, 2018, 2:21 PM Tim Peters <tim.peters@gmail.com> wrote:
\[Guido\]
\> .... as\_integer\_ratio() seems mostly cute (it has Tim Peters all
\> over it),

Nope! I had nothing to do with it. I would have been -0.5 on adding
it had I been aware at the time.

\- I expect the audience is tiny.

\- While, ya, \_I\_ have uses for it, I had a utility function for it
approximately forever (it's easily built on top of math.frexp()).

\- Especially now, fractions.Fraction(some\_float) is the same thing
except for return type.


\> OTOH it looks like Decimal has it,

Looks like ints got it first, and then spread to Decimal because "why
not?" ;-) The first attempt to spread it to Decimal I found was
rejected (which would have been my vote too):

https://bugs.python.org/issue8947


\> so I think this ship has sailed too and maybe it's best to add it to the
\> numeric tower just to be done with it.

Or rip it out of everything. Either way works for me ;-)
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/mertz%40gnosis.cx