[Python-Dev] (no subject) (original) (raw)

Simon Brunning SBrunning@trisystems.co.uk
Thu, 18 Apr 2002 17:09:14 +0100


From: Guido van Rossum [SMTP:guido@python.org] > What's still missing is the version for unicode. Note that my patch > http://www.python.org/sf/424606 works a little different: Here the > argument is a complete word that should be stripped, not a collection > of characters, i.e. > your version: "oofoo".strip("foo") => "" > my version: "oofoo".strip("foo") => "oo"

Aargh! I prefer my version -- it's more similar to the default usage (which boils down to something like s.strip(" \t\n\r\f")) and more practical (e.g. stripping trailing punctuation).

Me too. But what about:

"oofoo".strip("foo") => "" "oofoo".strip(["foo", "bar"]) => "oo"

I.e., strip could accept any sequence (rather than just a string) as its optional parameter, and strip all occurrences of any item in that sequence.

More flexible, but I can't think of a good use case, to be honest.

Cheers, Simon Brunning TriSystems Ltd. sbrunning@trisystems.co.uk


The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot accept liability for statements made which are clearly the senders own.