How do I make public and private attributes and methods in my classes?
Python follows the philosophy of we’re all adults here
with
respect to hiding attributes and methods; i.e. you should trust the
other programmers who will use your classes. Use plain attributes
whenever possible.
You might be tempted to use getter and setter methods instead of attributes, but the only reason to use getters and setters is so you can change the implementation later if you need to. However, Python 2.2 and later allows you to do this with properties: