Shouldn't %06s zero-pad a string?

Andrew Dalke adalke at
Fri Feb 14 18:27:50 CET 2003

Tim Daneliuk:
> I'm just curious - what is the rationale' for having this as a string
> method?  i.e., This seems more like a special-purpose feature than a
> generally-needed string operation.  Is there a PEP describing the genesis
> of zfill?

zfill was a function in the string library.  I don't know when it
was added, but there's a usenet post mentioning it in 1994, which
is well before the PEP era.

My guess is it was added because a new module function is
allowed to be non-interesting, and someone wanted it.  Then
when strings had methods, all appropriate functions from that
module were moved to methods, upcasting, as it were, its implied

                    dalke at

More information about the Python-list mailing list