[issue44258] Support PEP 515 for Fraction's initialization from string

2021-06-07 Thread Mark Dickinson
Change by Mark Dickinson : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> enhancement ___ Python tracker ___

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-06-07 Thread Mark Dickinson
Mark Dickinson added the comment: New changeset 89e50ab36fac6a0e7f1998501f36fcd2872a6604 by Sergey B Kirpichev in branch 'main': bpo-44258: support PEP 515 for Fraction's initialization from string (GH-26422) https://github.com/python/cpython/commit/89e50ab36fac6a0e7f1998501f36fcd2872a6604

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-29 Thread Mark Dickinson
Mark Dickinson added the comment: > How about '1_/_2'? I'd rather keep it consistent with the rules for int: that is, if I split on `'/'`, I'd expect the pieces to be parseable by `int`. As for spaces around the `/`, let's make that a separate issue. --

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-29 Thread Vedran Čačić
Vedran Čačić added the comment: How about '1_/_2'? I think making / more separated adds value... though of course, someone will ask about '1 / 2' next. :-) -- nosy: +veky ___ Python tracker _

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-28 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Fri, May 28, 2021 at 06:48:14AM +, Mark Dickinson wrote: > So yes please to the PR. There should be tests that check that only the > underscore rules allowed by `int` and the others are supported: e.g., > `Fraction("1__2")`, and `Fraction("1_2_")` sh

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-28 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +25017 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26422 ___ Python tracker ___ __

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-27 Thread Mark Dickinson
Mark Dickinson added the comment: +1 to the idea: `Decimal`, `float`, `complex` and `int` all understand the underscores; there's no good reason for `Fraction` not to. So yes please to the PR. There should be tests that check that only the underscore rules allowed by `int` and the others are

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-27 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : Right now: >>> from fractions import Fraction as F >>> F(1_2_3, 3_2_1) Fraction(41, 107) but >>> F('1_2_3/3_2_1') Traceback (most recent call last): File "", line 1, in File "/home/sk/src/cpython/Lib/fractions.py", line 115, in __new__ raise Va