[issue43520] Make Fraction(string) handle non-ascii slashes

2021-03-23 Thread Carl Anderson
Carl Anderson added the comment: >The proposal I like is for a unicode numeric normalization functions that >return the ascii equivalent to exist. @Gregory P. Smith this makes sense to me. That does feel like the cleanest solution. I'm currently doing s = s.replace("⁄",&

[issue43520] Make Fraction(string) handle non-ascii slashes

2021-03-22 Thread Carl Anderson
Carl Anderson added the comment: >Carl: can you say more about the problem that motivated this issue? @mark.dickinson I was parsing a large corpus of ingredients strings from web-scraped recipes. My code to interpret strings such as "1/2 cup sugar" would fall over every

[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Carl Anderson
Carl Anderson added the comment: I guess if we are doing slashes, then the division sign ÷ (U+00F7) should be included too. There are at least 2 minus signs too (U+002D, U+02D7). -- ___ Python tracker <https://bugs.python.org/issue43

[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Carl Anderson
Carl Anderson added the comment: from https://en.wikipedia.org/wiki/Slash_(punctuation) there is U+002F / SOLIDUS U+2044 ⁄ FRACTION SLASH U+2215 ∕ DIVISION SLASH U+29F8 ⧸ BIG SOLIDUS U+FF0F / FULLWIDTH SOLIDUS (fullwidth version of solidus) U+1F67C  VERY HEAVY SOLIDUS In XML and HTML

[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Carl Anderson
New submission from Carl Anderson : Fraction works with a regular slash: >>> from fractions import Fraction >>> Fraction("1/2") Fraction(1, 2) but there are other similar slashes such as (0x2044) in which it throws an error: >>> Fraction("0⁄2&q