[Python-Dev] deprecating string module?

David Abrahams David Abrahams" <david.abrahams@rcn.com
Thu, 30 May 2002 17:08:03 -0400

From: "Guido van Rossum" <guido@python.org>

> Is this still relevant to Python?


> Why are C++ member functions difficult to generic programs?

1. built-in types don't have member functions, so there's no way to get
them to work like something that does. For that reason, when a generic
function relies on member functions, it's "not very generic".

2. By the same token, if a generic function requires that a type have
particular member functions, some class types may be ineligible for use
with that function. If the requirement is simply that the appropriate free
functions exist, it's usually possible to write them. This becomes a factor
when using generic library A with a type from library B.

> Does the same apply to Python methods?

#1 obviously doesn't, except that of course the built-in types have a fixed
set of methods. #2 might apply. The general trend towards decoupling
algorithms and data structures in C++ is one of those Good Things (tm).