
Someone just posted a patch to implement s.chomp() as a string method: http://sourceforge.net/patch/?func=detailpatch&patch_id=103029&group_id=5470 Pseudo code (for those not aware of the Perl function by that name): def chomp(s): if s[-2:] == '\r\n': return s[:-2] if s[-1:] == '\r' or s[-1:] == '\n': return s[:-1] return s I.e. it removes a trailing \r\n, \r, or \n. Any comments? Is this needed given that we have s.rstrip() already? --Guido van Rossum (home page: http://www.python.org/~guido/)

On Thu, 28 Dec 2000 10:04:23 -0500, Guido <guido@digicool.com> wrote:
I've always considered this a different operation from rstrip(). When you intend to be as surgical in your changes as possible, it is important *not* to use rstrip(). I don't feel strongly that it needs to be implemented in C, though I imagine people who do a lot of string processing feel otherwise. It's just hard to beat the performance difference if you are doing this a lot. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations

Charles G Waldman writes: | | P=NP (Python is not Perl) Is it too late to suggest this for the SPAM9 t-shirt? :)

By just about a day -- I haven't seen the new design yet, but Just & Eric were supposed to design it today and hand in the final proofs tomorrow. I believe the slogan will be "it fits your brain" (or "it fits my brain"). But if you print a bunch of P=NP shirts, I'm sure you can sell them with a profit, both in Long Beach and in San Diego (at the O'Reilly Open Source conference)... --Guido van Rossum (home page: http://www.python.org/~guido/)

On Sun, 14 Jan 2001 21:24:36 -0500, Guido van Rossum <guido@python.org> wrote:
And the Libre Software Meeting (http://lsm.abul.org), which has a Python subtopic too. (Since it's in France, no one is calling it "free", so it's probable you can sell those T-shirts there...) -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses!

Guido van Rossum wrote:
We already have .splitlines() which does the above (remove line breaks) not only for a single line, but for many lines at once. Even better: .splitlines() also does the right thing for Unicode. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/

On Thu, 28 Dec 2000, "M.-A. Lemburg" <mal@lemburg.com> wrote: [about chomp]
OK, I retract my earlier +1, and instead I move that this be added to the FAQ. Where is the FAQ maintained nowadays? The grail link doesn't work anymore. -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses!

On Thu, 28 Dec 2000 10:04:23 -0500, Guido <guido@digicool.com> wrote:
I've always considered this a different operation from rstrip(). When you intend to be as surgical in your changes as possible, it is important *not* to use rstrip(). I don't feel strongly that it needs to be implemented in C, though I imagine people who do a lot of string processing feel otherwise. It's just hard to beat the performance difference if you are doing this a lot. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations

Charles G Waldman writes: | | P=NP (Python is not Perl) Is it too late to suggest this for the SPAM9 t-shirt? :)

By just about a day -- I haven't seen the new design yet, but Just & Eric were supposed to design it today and hand in the final proofs tomorrow. I believe the slogan will be "it fits your brain" (or "it fits my brain"). But if you print a bunch of P=NP shirts, I'm sure you can sell them with a profit, both in Long Beach and in San Diego (at the O'Reilly Open Source conference)... --Guido van Rossum (home page: http://www.python.org/~guido/)

On Sun, 14 Jan 2001 21:24:36 -0500, Guido van Rossum <guido@python.org> wrote:
And the Libre Software Meeting (http://lsm.abul.org), which has a Python subtopic too. (Since it's in France, no one is calling it "free", so it's probable you can sell those T-shirts there...) -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses!

Guido van Rossum wrote:
We already have .splitlines() which does the above (remove line breaks) not only for a single line, but for many lines at once. Even better: .splitlines() also does the right thing for Unicode. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/

On Thu, 28 Dec 2000, "M.-A. Lemburg" <mal@lemburg.com> wrote: [about chomp]
OK, I retract my earlier +1, and instead I move that this be added to the FAQ. Where is the FAQ maintained nowadays? The grail link doesn't work anymore. -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses!
participants (8)
-
Captain Senorita
-
Charles G Waldman
-
Fred L. Drake
-
Guido van Rossum
-
Guido van Rossum
-
M.-A. Lemburg
-
Mark Hammond
-
Moshe Zadka