Methods vs. Functions (Re: [Python-Dev] A house upon the sand)
Barry A. Warsaw
Mon, 27 Nov 2000 19:10:56 -0500
>>>>> "GE" == Greg Ewing <firstname.lastname@example.org> writes:
GE> Anyone with an interest in the string functions vs.
GE> string methods debate should read this article, which
GE> was referenced in comp.lang.python recently:
| How Non-Member Functions Improve Encapsulation
| by Scott Meyers
GE> Mr. Meyers presents some very well-reasoned arguments
GE> against the everything-should-be-a-method mentality.
Remember that Meyers is talking about C++ here, where there's a
distinction in the `friendliness' of a function. He himself says that
the choice is between non-member non-friend functions and member
functions (i.e. methods). Friend functions have the same dependency
on implementation changes as methods.
In Python, there is no such friend distinction, although you can come
close to faking it with private names. So the argument based on
degrees of encapsulation doesn't hold water in Python.