Skip to content

Add conjunction option to natural_list - #398

Draft
zihjiang wants to merge 1 commit into
python-humanize:mainfrom
zihjiang:feat/natural-list-conjunction-214
Draft

zihjiang wants to merge 1 commit into
python-humanize:mainfrom
zihjiang:feat/natural-list-conjunction-214

Conversation

@zihjiang

Copy link
Copy Markdown

Summary

Add a configurable conjunction to natural_list().

Changes

  • Add a conjunction parameter defaulting to "and".
  • Support custom conjunctions such as "or" and "and also" for two-item and longer lists.
  • Preserve existing behavior for empty and single-item iterables.
  • Document the new parameter and usage example.

Tests

  • uv run pytest -q — 729 passed, 74 skipped
  • uvx ruff check src/humanize/lists.py tests/test_lists.py
  • uvx ruff format --check src/humanize/lists.py tests/test_lists.py
  • uvx prek run --files src/humanize/lists.py tests/test_lists.py
  • git diff --check

Fixes #214

@hugovk hugovk changed the title feat: add conjunction option to natural_list Add conjunction option to natural_list Sep 16, 2026
@hugovk hugovk added the changelog: Added For new features label Sep 16, 2026
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.57%. Comparing base (3201e70) to head (30092ce).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #398   +/-   ##
=======================================
  Coverage   99.56%   99.57%           
=======================================
  Files          12       12           
  Lines         927      931    +4     
=======================================
+ Hits          923      927    +4     
  Misses          4        4           
Flag Coverage Δ
macos-latest 97.63% <100.00%> (+0.01%) ⬆️
ubuntu-latest 97.63% <100.00%> (+0.01%) ⬆️
windows-latest 95.48% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Added For new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal for additional conjunction parameter in natural_list function

2 participants