[issue39418] str.strip() should have a means of adding to the default behaviour

2021-03-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Marking this as closed because the issue doesn't seem to have gathered much interest. If someone wants to move this forward, I recommend discussing it on python-ideas. -- resolution: -> rejected stage: -> resolved status: open -> closed __

[issue39418] str.strip() should have a means of adding to the default behaviour

2021-03-25 Thread Irit Katriel
Irit Katriel added the comment: In python 3.9 there is also str.removeprefix: https://docs.python.org/3/library/stdtypes.html#str.removeprefix which you can apply in a loop. -- components: +Library (Lib) nosy: +iritkatriel ___ Python tracker

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: For this problem, I would reach for regular expressions. They are specifically designed for flexibility and customization. -- nosy: +rhettinger ___ Python tracker _

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: Attached is a script I used to test: * that str.isspace() currently matches the definition given in the docs; * that string.whitespace contains all whitespace characters, and nothing but whitespace; * that str.strip() strips off all whitespace characters,

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Natalie Amery
Natalie Amery added the comment: https://bugs.python.org/issue25433 has a summary of the issue about what actually constitutes whitespace from the perspective of improving the documentation. In terms of what strip does it turns out that string.whitespace is a red herring. A list of whitespa

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: There's a discrepancy between the string.whitespace constant and actual whitespace as tested by the str.isspace() method. I've found five ASCII whitespace characters (as reported by isspace) which aren't in the string.whitespace constant, and 18 non-ASCII w

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a new feature, not a bug, so it will apply only to 3.9. All older versions are in feature freeze. > there's no way to programatically acquire what characters are considered > whitespace https://docs.python.org/3/library/stdtypes.html#str.isspace h

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Natalie Amery
Natalie Amery added the comment: Oops, sorry, that should say 'strip' througout not 'split'. My bad. -- ___ Python tracker ___ ___

[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Natalie Amery
New submission from Natalie Amery : If I want to remove the default set of 'whitespace' characters plus something else from a string there's currently no way to cleanly specify that. In addition there's no way to programatically acquire what characters are considered whitespace so you can't