python / python/cpython

Improve `unicodedata.numeric` return value

Open
#136,398 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib topic-unicode type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

As 1/20 != 3602879701896397/72057594037927936. Maybe add a Fraction function to the unicodedata object?


import unicodedata
from fractions import Fraction

c = '൛'
str(Fraction(unicodedata.numeric(c)))


CPython versions tested on:

3.11

Operating systems tested on:

Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Python snippet at the unicodedata.numeric entry point and compare its result with Fraction. No source file or test is named in the issue; before implementation, clarify whether the desired outcome is a Fraction-based API or another exact representation, then define regression coverage and the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.