[Python-bugs-list] [ python-Feature Requests-662827 ] optional pad character for zfill and center

SourceForge.net noreply@sourceforge.net
Fri, 10 Jan 2003 01:42:56 -0800


Feature Requests item #662827, was opened at 2003-01-05 16:28
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=662827&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Torpey (dtorp)
Assigned to: Nobody/Anonymous (nobody)
Summary: optional pad character for zfill and center

Initial Comment:
>>> 'padme'.zfill(10, '*')
'*****padme'
>>> 'padme'.center(10, '*')
'**padme***'


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-10 04:42

Message:
Logged In: YES 
user_id=80475

The optional character for center seems like a useful idea 
to me.  People occasionally like to center captions in fields 
of hyphens or asterisks.  Note, this proposal is similar to 
the recent "optional character" enhancements to str.strip
(), str.lstrip(), and str.rstrip().

Doing the same for zfill() is more problematic because 
both its name and function do not equate to "padleft".  
The 'z' in zfill implies that a zero will be used.  The actual 
function not only fills to the left, but also repositions any 
leading minus signs.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=662827&group_id=5470