You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2011-06-30.17:46:11.282>created_at=<Date2011-06-29.20:56:36.875>labels= ['type-feature', 'library']
title='accept sets or collections for str.strip/lstrip/rstrip'updated_at=<Date2011-06-30.17:46:11.280>user='https://github.com/petere'
It appears to be a pretty common mistake to think that the argument of str.strip/lstrip/rstrip is a substring rather than a set of characters. To allow a more clearer notation, it would be nice if these functions also accepted an argument other than a string, for example a set or any collection. Then you could write, for example:
a.strip({'a', 'b', 'c'})
I suggest to either add support for sets specifically, or more generally anything that supports the "in" operator.
-1 on complicating the API. The purported problem isn't pervasive enough to warrant a change (I frequently teach python classes and do code reviews and rarely encounter this issue). Also, the proposed change isn't going to help the people who are setting out to remove a ".html" suffix and are presuming that rstrip is the way to do it. Those folks have already made an unfounded assumption this proposal does nothing to invalidate their experiment. AFAICT, this proposal would only benefit someone who already knows that strip characters are accepted in all combinations (as clearly documented).
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: