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

Hans Nowak wurmy at earthlink.net
Thu Feb 13 22:41:39 EST 2003


Beat Bolli wrote:

> Jeff Epler wrote:
> 
>> so "the behavior is undefined" when the s conversion is used.
>> The treatment of 0 as " " (space) seems fairly useful, though.
>>
> That's all fine, but the *Python* manual mentions no such limitation. 
> Wouldn't be simpler to handle all cases consistently?

Padding a string with zeroes doesn't make a lot of sense.  Padding it with 
spaces seems more useful.  Practicality beats purity, and all that.

> Still-wondering-whether-to-file-a-bug-ly yours

I suppose you could file a documentation bug... a request to mention this 
behavior in the documentation.

Cheers,

-- 
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
Kaa:: http://www.awaretek.com/nowak/kaa.html
Soon: http://zephyrfalcon.org/





More information about the Python-list mailing list