Some Python 2.1 ideas

Alex Martelli aleaxit at
Sun Dec 24 23:30:30 CET 2000

"Thomas Wouters" <thomas at> wrote in message
news:mailman.977688488.25438.python-list at
> > > Wouldn't it be cleaner to enhance the file object with additional
> > > methods:
> > >
> > >   f. readline_chomp()
> > >   f.readlines_chomp()
> > This would be a good idea, except it wouldn't fit with the standard
Python idiom
> > for reading files:
> And everything that poses as a file object would have to duplicate those
> functions, all of a sudden. Guido is pretty conservative in adding
> conveniency functions to builtin (and oft-imitated) objects because of

A mixin-class (implementing, e.g., readline_chomp in terms of .readline
and chomp, in this case) could also be supplied to ease the task of
'emulating convenience-methods'.  Not crucial in this case (the proposed
methods appear somewhat marginal), but an approach that might help
in other cases, I think.


More information about the Python-list mailing list