[Python-Dev] deprecating string module?

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 31 May 2002 12:39:38 +1200 (NZST)


Guido van Rossum <guido@python.org>:

> > This is funny. In the C++ community there's a nearly unanimous
> > consensus that way too much of the functionality of the standard
> > strings is expressed as member functions.
> 
> Interesting.  Python used to have the same attitude, hence the string
> module -- but the existence of multiple string types made methods more
> attractive.

I don't understand how using methods makes multiple
string types easier to deal with.

Suppose I want to define my own string-like type. How
do I arrange things so that " ".join(x) does the right
thing when x contains instances of my new type? How
is this made easier by the fact that join is a method
of " " rather than a free function?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+