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

intcomma returns scientific notation for large floats

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

维护者通常 2 天内回复

@TheNetherWatcher 已经在做这个了。

开始于 2026年10月2日。

  • #432 来自 @TheNetherWatcher —— 未关闭
  • #443 来自 @Jah-yee —— 未关闭

评估

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

调研方向

从 intcomma() 入口开始,复现报告中的大浮点数和小浮点数示例。跟踪浮点数格式化路径,并添加覆盖测试,表明 1e16 和 0.00001 等值使用带分组的十进制表示法,与 issue 中的预期输出一致。

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

描述

intcomma() returns scientific notation for floats of 1e16 and above, with no commas added:

>>> humanize.intcomma(1e15)
'1,000,000,000,000,000.0'
>>> humanize.intcomma(1e16)
'1e+16'
>>> humanize.intcomma(1.5e20)
'1.5e+20'

I expected '10,000,000,000,000,000.0' and '150,000,000,000,000,000,000.0'. Passing ndigits works around it (intcomma(1e16, 0) gives '10,000,000,000,000,000').

This happens because f"{value:,}" on a float uses the same formatting as repr(), and that switches to an exponent at 1e16. Small floats hit the same thing, e.g. intcomma(0.00001) returns '1e-05'.

主要语言
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 摘要。