This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年06月29日 20:56 by petere, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg139449 - (view) | Author: Peter Eisentraut (petere) * | Date: 2011年06月29日 20:56 | |
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.
I can try to code it up if it sounds acceptable.
|
|||
| msg139451 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2011年06月29日 21:46 | |
-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). |
|||
| msg139490 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月30日 15:11 | |
Agreed with Raymond. Is there some way the doc could be improved, or do we just close this report? |
|||
| msg139504 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2011年06月30日 17:46 | |
The docs are clear on this topic. No doc change can help someone who skips reading the docs and assumes the method does something different. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:19 | admin | set | github: 56653 |
| 2011年06月30日 17:46:11 | rhettinger | set | status: open -> closed resolution: rejected messages: + msg139504 |
| 2011年06月30日 15:11:22 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg139490 |
| 2011年06月29日 22:14:05 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2011年06月29日 21:46:40 | rhettinger | set | nosy:
+ rhettinger messages: + msg139451 |
| 2011年06月29日 20:56:36 | petere | create | |