Kent Johnson wrote:
The reason that is given for using accessors is that it gives you a layer of flexibility; if you want to change the representation of the data, or make it a computed attribute, you can do that without impacting clients.

Python, instead, lets you change what attribute access means. The way to do this is with 'properties'. This is kind of an advanced topic, here are two references: http://www.python.org/2.2.1/descrintro.html#property
http://www.python.org/doc/2.2.3/whatsnew/sect-rellinks.html#SECTION000340000000000000000

Here is a blog entry that clearly explains the difference between Java and Python on this point. It also has a great explanation of why Python IDEs are not as popular as Java IDEs.
http://naeblis.cx/rtomayko/2005/01/20/getters-setters-fuxors


Kent


_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to