Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

metric() adds a digit when a value rounds into quetta

未关闭 适合新手
#423 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@SashaMIT 已经在做这个了。

开始于 2026年10月1日。

  • #424 来自 @SashaMIT —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
tooling

调研方向

从 metric() 入口开始,运行 issue 中所示的复现,以确认 quetta 边界行为。跟踪 9.996e30 到 9.996e32 附近的舍入和前缀选择,然后验证输出与四个预期示例一致,并保留现有的 9999 结果。

由索引模型根据 Issue 内容生成。

描述

What did you do?
import humanize
print(humanize.metric(9.996e30))
print(humanize.metric(9.996e31))
print(humanize.metric(9.996e32))
print(humanize.metric(9999))
What did you expect to happen?

Three digits, same as 9999, which is already 10.0 k and not 10.00 k.

10.0 Q
100 Q
1.00 x 10³³
10.0 k

9.996e32 has no prefix after quetta, so scientific notation.

What actually happened?
10.00 Q
100.0 Q
1000 Q
10.0 k

The rounding carry stops at exponent 30. 2.596e32 is still 260 QF.

What versions are you using?
  • OS: macOS
  • Python: 3.14
  • Humanize: main
主要语言
Python
星标
760
派生
166
平均合并
4 天 3 小时
30 天内合并 PR
7

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python-humanize/humanize 的其他 Issue

查看 python-humanize/humanize 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。