Does Python really follow its philosophy of "Readability counts"?

Russ P. Russ.Paielli at gmail.com
Tue Jan 20 04:20:48 CET 2009


On Jan 19, 6:24 pm, "James Mills" <prolo... at shortcircuit.net.au>
wrote:

> Python programmers tend to not have a need for
> properties. Quite honestly they are a waste of time.
> They come from traditional OO approaches to software design
> (and mostly from the Java world).

With statements like that, it's no wonder you don't understand the
value of encapsulation.

With encapsulation (whether enforced or voluntary), no one has the
"need" for properties. You can always just provide functions to do the
same job. What properties do is to essentially make the function call
simpler for the client. The client just sets the radius of the circle,
and, lo and behold, the area gets changed automatically and
consistently.

If you didn't plan ahead and encapsulate the radius from the start,
properties allow you to save yourself and encapsulate it later without
breaking the client's code.




More information about the Python-list mailing list