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

Guido van Rossum guido@python.org
Mon, 27 Nov 2000 19:12:01 -0500


> 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.
> 
> in-python-everyone's-your-friend-and-thank-guido-for-that-ly y'rs,

I disagree.  While non-methods *can* look inside an implementation,
it's still implied that they break encapsulation if they do.  (This
may explain why you like to use private names -- they make the
encapsulation explicit.  For me, it exists even when it is implicit.)

--Guido van Rossum (home page: http://www.python.org/~guido/)