On Sat, May 11, 2013 at 1:21 AM, Roy Smith <r...@panix.com> wrote: > In article <mailman.1532.1368198547.3114.python-l...@python.org>, > Chris Angelico <ros...@gmail.com> wrote: >> >> Agreed, in generality. But what is actually gained by hiding data from >> yourself? > > You're not hiding it from yourself. You're hiding it from the other > people who are using your code and may not understand all the subtle > gotchas as well as you do.
True. And on looking over my code, I find that there are a few cases where I've used private members: I have a buffer class that acts pretty much like a non-refcounted string, and it declares a private copy constructor to prevent accidental misuse. But it's the exception, not the rule. My main point isn't about the cases where you actually want to prevent access, but the all-too-common case where the member itself is private and there are two public methods to get and set it. Massive boilerplate. Completely unnecessary in 99%+ of cases. ChrisA -- http://mail.python.org/mailman/listinfo/python-list