accessor/mutator functions
Dan Sommers
me at privacy.net
Tue Mar 1 07:37:16 EST 2005
On 01 Mar 2005 10:30:01 GMT,
Nick Craig-Wood <nick at craig-wood.com> wrote:
> However in python, there is no harm in accessing the attributes
> directly. You can change the implementation whenever you like, and
> change the attributes into property()s and the users will never know.
[ ... ]
> Read only attributes are easy to understand, unlikely to go wrong and
> faster than getBlah() accessor methods.
> Writable attributes I think are good candidates for methods though.
> Looking inside an object is one thing but changing its internal state
> is another and should probably be done through a defined interface.
I wish I'd said it that well in the first place myself. :-)
Regards,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
μ₀ × ε₀ × c² = 1
More information about the Python-list
mailing list