A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-December/058610.html below:

[Python-Dev] PEP 8 updates/clarifications

[Python-Dev] PEP 8 updates/clarifications [Python-Dev] PEP 8 updates/clarificationsJim Fulton jim at zope.com
Mon Dec 12 19:52:28 CET 2005
skip at pobox.com wrote:
>     Jim> That's why, in my suggested writeup, I suggested that attributes
>     Jim> should be used if the accessors are trivial.
> 
> In my experience it's difficult to find the locations where another module
> mucks with your object's state.  Using properties or accessor methods
> coupling between modules is reduced and you can be more confident that the
> only place an object's state is modified directly is in its own code.

I don't understand this argument.  Any mutating method or property invoked by
foreign code changes an object's state.  If you provide a property or a pair
if accessors that just sets and gets an attribute with a slightly different name,
that affords no more protection than if people were setting the attribute directly.

If you don't want external code to change an attribute, don't expose it through
a public API.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4