[Python-Dev] deprecating string module?
David Abrahams
David Abrahams" <david.abrahams@rcn.com
Thu, 30 May 2002 09:01:20 -0400
From: "Guido van Rossum" <guido@python.org>
> > > These "use cases"
> > > don't convince me that there's a legitimate use case for
> > > string.letters etc. that the methods don't cover.
> >
> > 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.
>
> What's the alternative proposed for C++?
Free functions at namespace scope. The analogy would be module-level
functions in Python. C++ also has multiple string types, but the
availability of overloading makes this approach practical (is it time for
Python multimethods yet?)
If I were to make arguments against string member functions in Python I'd
be talking about the degree of coupling between algorithms and data
structures, how it interferes with genericity, and the difficulty that
users will have in making "string-like" types...
but-i-would-never-make-such-silly-arguments-ly y'rs,
dave