method names nounVerb or verbNoun

Carl Banks pavlovevidence at gmail.com
Sat Feb 6 10:56:41 CET 2010


On Feb 5, 3:36 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Fri, Feb 5, 2010 at 2:45 PM, Steven D'Aprano
>
> <st... at remove-this-cybersource.com.au> wrote:
> > For instance, if getting or setting the voltage is an expensive
> > operation, you don't want to fool the user into thinking it is a cheap
> > attribute access.
>
> I strongly disagree with this rationale as it violates the Uniform
> Access Principle
> (http://en.wikipedia.org/wiki/Uniform_access_principle). Though I
> concede Python's builtins don't adhere to the UAP.

And I strongly disagree with the Uniform Access Principle.  I want my
accesses to an object to be explicitly "data-like" or "method-like",
even if

Based on the Wikipedia page, Meyer's main reason behind UAP seems to
be to minimize the need to break interfaces: the UAP is a means to an
end.  Python achieves that end without the conforming to UAP,
therefore it doesn't need it, and there's no reason to adhere to it.


Carl Banks



More information about the Python-list mailing list