Accessors in Python (getters and setters)

Ant antroy at gmail.com
Thu Jul 13 07:57:25 EDT 2006


We seem to be flogging a dead horse now. Is the following a fair
summary:

Q. What is the Pythonic way of implementing getters and setters?

A. Use attributes.

Quote: "I put a lot more effort into choosing method and function
names"

Wisdom: Python is a different paradigm from (e.g.) Java w.r.t.
accessors: Put the effort you would have put into choosing accessor
names into choosing attribute names.

Anything else to add to this? Or can it be put to bed?




More information about the Python-list mailing list