Methods vs. Functions (Re: [Python-Dev] A house upon the sand)

M.-A. Lemburg
Tue, 28 Nov 2000 00:45:44 +0100

Greg Ewing wrote:
> Anyone with an interest in the string functions vs.
> string methods debate should read this article, which
> was referenced in comp.lang.python recently:
>     How Non-Member Functions Improve Encapsulation
>     by Scott Meyers
> Mr. Meyers presents some very well-reasoned arguments
> against the everything-should-be-a-method mentality.

Note that the motivation for turning to string methods was
that of migrating from strings to Unicode. Adding Unicode
support to the strop C module would have caused very complicated
code -- methods helped by enabling polymorphic code which is
one of the great advantages of writing software for an interface
rather than an implementation.

Note that functions can make very good use of methods and
thus implement polymorphic functionality -- this is not
about methods vs. functions it's about methods to enable
polymorphic functions.

Marc-Andre Lemburg
Python Pages: