[Python-Dev] deprecating string module?

Martin v. Loewis martin@v.loewis.de
31 May 2002 00:49:30 +0200

Guido van Rossum <guido@python.org> writes:

> Is this still relevant to Python?  Why are C++ member functions
> difficult to generic programs?  Does the same apply to Python methods?

In a generic algorithm foo, you can write

def foo1(x):

if you have global functions. With methods, you need to write

def foo1(x):

which means that bar must be a method of x. This might be difficult to
achieve if x is of a class that you cannot control. In C++, it is then
still possible to define a function

def bar(x of-type-X):

which, by means of overload resolution, will be found from foo1

In Python, this is not so easy since you don't have overloading.