[issue4541] Add str method for removing leading or trailing substrings

2008-12-05 Thread David W. Lambert
David W. Lambert [EMAIL PROTECTED] added the comment: Opinion---Batteries included doesn't mean a bewildering variety of functions. Nor does it mean my programming language has a checklist of features such as I recall the spreadsheet and word processor wars of the (19)80's. Python should

[issue4541] Add str method for removing leading or trailing substrings

2008-12-05 Thread Zach Hirsch
Zach Hirsch [EMAIL PROTECTED] added the comment: Sounds good to me, except for one thing: define sensible. To me, lstrips seems sensible, since it's a recurring pattern that I've used in multiple locations. But perhaps my sense of sensibility is warped :)

[issue4541] Add str method for removing leading or trailing substrings

2008-12-05 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: I agree with Lambert. Am rejecting this one on the basis that it adds too little value, is too easily accomplished with pure python, and that it makes the list of string methods unnecessarily more complex and harder to learn. --

[issue4541] Add str method for removing leading or trailing substrings

2008-12-04 Thread Zach Hirsch
New submission from Zach Hirsch [EMAIL PROTECTED]: I've found that having a way to strip a leading substring from a string is convienent. I've also gotten bitten by the fact that str.strip takes a sequence of characters to remove from the beginning -- not a full string. I've attached a patch

[issue4541] Add str method for removing leading or trailing substrings

2008-12-04 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: I cannot say if this new set of function is desirable in python, but I know that I already needed this feature sometimes. It's very easy to write in python code, though: def rstrips(s, suffix): if suffix and s.endswith(suffix):

[issue4541] Add str method for removing leading or trailing substrings

2008-12-04 Thread Zach Hirsch
Zach Hirsch [EMAIL PROTECTED] added the comment: Thanks for taking a look. Yea, it's pretty easy to write it in Python, but I've found that I've needed it in quite a few things that I've worked on, so I thought it might be useful in Python itself. I've updated the patch to fix the reference