why the string function / module change

Remco Gerlich scarblac at pino.selwerd.nl
Wed Feb 21 17:32:46 EST 2001


David Bolen <db3l at fitlinxx.com> wrote in comp.lang.python:
> If you think about, the string module was the odd man out.  After all,
> if you want to read or write to a file object, you use
> <fileobj>.read() and <fileobj>.write().  You don't use
> filemodule.read(<fileobj>) and filemodule.write(<fileobj>).
> 
> If you are appending to a list object you use <listobj>.append(), and
> not listmodule.append(<listobj>).  Similarly with dictionaries, and so on...

But lists and dictionaries are mutable, and files are as well, in a way.
Strings are not. Nor are tuples and integers, and those don't have methods
either. So strings were hardly an odd one out.

I like the string methods (maybe " ".join() is taking it a bit far) but I
think this reason is a bit weak.

-- 
Remco Gerlich



More information about the Python-list mailing list