Some Python 2.1 ideas

Roy Smith roy at
Mon Dec 25 17:36:13 CET 2000

"Bob Alexander" <bobalex at> wrote:
> Finally, I'd be disappointed if the name "chomp" actually survived! I 
> just used it in my initial post as a placeholder until a better name 
> came along, since some folks would likely recall it from Perl.

We've already got the string methods strip, lstrip, and rstrip.  Why not 
just add an optional second argument which is the class of characters to 
strip.  Then chomp just becomes string.rstrip (input_string, '\n').

Even better, an optional argument to readlines to have it do the 
chomping itself.

More information about the Python-list mailing list