[New-bugs-announce] [issue44115] Improve conversions for fractions

Martin Teichmann report at bugs.python.org
Wed May 12 09:09:37 EDT 2021

New submission from Martin Teichmann <martin.teichmann at gmail.com>:

Currently, fraction.Fractions can be generated from floats via their as_integer_ratio method. This had been extended to also work with the Decimals class. It would be more generic - and IMHO more Pythonic - to just allow any data type, as long as it has an as_integer_ratio method.

As an example, this allows numpy floats to be converted into fractions.

components: Library (Lib)
messages: 393507
nosy: Martin.Teichmann
priority: normal
severity: normal
status: open
title: Improve conversions for fractions
type: enhancement
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list