Proposal for additional `conjunction` parameter in `natural_list` function
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- localization
调研方向
首先定位 natural_list 的实现及其文档,然后查看 issue #103 中的相关讨论。确认当前默认输出是如何生成的,并找出 natural_list 现有的测试或示例;完成的标准是支持所请求的替代连词,同时保留当前的默认行为。
由索引模型根据 Issue 内容生成。
描述
Thank you for the new version; natural_list really resolves several issues.
Summary
I would like to propose an enhancement to the natural_list function. Currently, the output for the list [1, 2, 3] is formatted as "1, 2 and 3". I propose adding a parameter that allows users to choose between "and" or "or" in the output.
I checked the documentation and found in #103 that there is interest in implementing something like this issue.
Motivation
This enhancement would provide more flexibility in how lists are presented, particularly in contexts where the choice between "and" and "or" is significant.
Proposed Changes
- Introduce a new parameter (e.g.,
conjunction) to thenatural_listfunction. - Accept boolean values for this parameter:
True(default behavior)False
Example Usage
With the proposed change, the usage would look like this:
from humanize import natural_list
print(natural_list([1, 2, 3])) # Output: "1, 2 and 3"
print(natural_list([1, 2, 3], conjunction=False)) # Output: "1, 2 or 3"
Another Idea
We could also consider adding or and and to the i18n support for multiple languages, but I believe that should be addressed in a separate issue.
I could submit the PR if there's interest, but I'm not sure if conjunction would be the best name for this parameter.
- 主要语言
- Python
- 星标
- 757
- 派生
- 148
- 平均合并
- 6 天 1 小时
- 30 天内合并 PR
- 12
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-humanize/humanize 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
python-humanize/humanize#379 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
python-humanize/humanize#366 ·
-
难度 3/5 1-2 天 新手友好度 52/100
python-humanize/humanize#356 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 48/100
python-humanize/humanize#277 · 1 条评论 ·
-
bug
难度 4/5 3-5 天 新手友好度 45/100
python-humanize/humanize#270 · 6 条评论 ·
查看 python-humanize/humanize 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 88/100
use-agent-os/agent-os#3314 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
BasedHardware/omi#15662 · 1 条评论 ·
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 62/100
AiursoftWeb/AnduinOS-2#19 ·