mutually exclusive arguments to a constructor

Chris Angelico rosuav at gmail.com
Fri Dec 30 18:47:20 EST 2011


On Sat, Dec 31, 2011 at 10:39 AM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.4256.1325288188.27778.python-list at python.org>,
>  Chris Angelico <rosuav at gmail.com> wrote:
>
>> You know a Python programmer's been at your C++ code when it opens:
>> #define class struct
>
> Why stop there?
>
> #define private public

Probably yeah, do both. Anyway, life's so much easier when you don't
have to write trivial getter/setter methods (and then maintain them).
I've never had a situation where I've changed a private member while
keeping the getters and setters unchanged; the ONLY benefit accessor
methods have ever given to me personally has been logging (and
granted, that is hard to do without them - since you can't override
__getitem__ in C++ - but how often do you really need that facility?).

I used to believe in the separation of interface from implementation.
Then I realised that most of the separation was transparent anyway,
and gave up on it. And then realised why the separation is a good idea
after all. :)

ChrisA



More information about the Python-list mailing list