[issue44115] Improve conversions for fractions

2021-05-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: rhettinger -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue44115] Improve conversions for fractions

2021-05-13 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue44115] Improve conversions for fractions

2021-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was proposed before in issue37884. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Pyt

[issue44115] Improve conversions for fractions

2021-05-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Note for posterity: I tried out pattern matching here but it was a little tricky and it slowed down the code a bit. At at least it worked. if denominator is None: match numerator: case int(x) if type(numerator) is int

[issue44115] Improve conversions for fractions

2021-05-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue44115] Improve conversions for fractions

2021-05-12 Thread Vedran Čačić
Vedran Čačić added the comment: Absolutely. I think that's a big part of the reason that as_integer_ratio is there. -- nosy: +veky ___ Python tracker ___ _

[issue44115] Improve conversions for fractions

2021-05-12 Thread Martin Teichmann
Change by Martin Teichmann : -- keywords: +patch pull_requests: +24705 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26064 ___ Python tracker ___

[issue44115] Improve conversions for fractions

2021-05-12 Thread Martin Teichmann
New submission from Martin Teichmann : 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