[Python-Dev] deprecating string module?

David Abrahams David Abrahams" <david.abrahams@rcn.com
Sat, 1 Jun 2002 07:42:09 -0400


> In python, you don't need overloading, you have a variety of
> optional parameter mechanisms

...which forces users to write centralized dispatching mechanism that could
be much more elegantly-handled by the language. The language already does
something just for operators, but the rules are complicated and don't scale
well.

> I think the "member functions" issues from C++ don't apply to
> Python becuase C++ is strongly typed, meaning that many similar
> functions have to be written with slightly different type
> signatures.

That's very seldom the case in my C++ code. Why would you do that in lieu
of writing function templates?

I think Martin hit the nail on the head: you can achieve some decoupling of
algorithms from data structures using free functions, but you need some way
to look up the appropriate free function for a given data structure. FOr
that, you need some kind of overload resolution.

> The lack of strong typing makes it practical to
> write generic operations.

Templates and overloading in C++ make it practical to write
statically-type-checked generic operations.