Skip to content

feat: add zfill to str, bytes and bytearray - #273

Merged
jonruttan merged 1 commit into
mainfrom
feat/str-zfill
Nov 28, 2026
Merged

jonruttan merged 1 commit into
mainfrom
feat/str-zfill

Conversation

@jonruttan

Copy link
Copy Markdown
Owner

Adds zfill to str, bytes and bytearray, matching CPython 3.14.

  • Left-pads with 0 to the width; a leading + or - stays in front of the padding.
  • A width at or below the length returns the value unchanged.
  • The wrong number of arguments raises CPython's TypeError.

Spec: a new case in tests/specs/41-string-repeat.spec.md, with its expected output taken from python3.14.

Tests: suite 1292 passed / 0 failed; conformance 644 / 10 failed, the same 10 as main.

🤖 Generated with Claude Code

zfill pads on the left with zeros to the given width, keeping a
leading sign in front of the padding. A missing or extra argument
raises the TypeError CPython gives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonruttan
jonruttan merged commit 69315bc into main Nov 28, 2026
12 checks passed
@jonruttan
jonruttan deleted the feat/str-zfill branch November 28, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant