Message388865
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")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda3/lib/python3.7/fractions.py", line 138, in __new__
numerator)
ValueError: Invalid literal for Fraction: '0⁄2'
This seems to come from the (?:/(?P<denom>\d+))? section of the regex _RATIONAL_FORMAT in fractions.py |
|
Date |
User |
Action |
Args |
2021-03-16 18:09:04 | weightwatchers-carlanderson | set | recipients:
+ weightwatchers-carlanderson |
2021-03-16 18:09:04 | weightwatchers-carlanderson | set | messageid: <1615918144.03.0.939769511159.issue43520@roundup.psfhosted.org> |
2021-03-16 18:09:04 | weightwatchers-carlanderson | link | issue43520 messages |
2021-03-16 18:09:03 | weightwatchers-carlanderson | create | |
|