Re: Minimal working example (Re: set_buffer_mode)

Chris Angelico <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAPTjJmqWAYTqYOCM0hGUuLUg=oRoy=L9jPPy+77YuiCF7M+smQ@mail.gmail.com>
On Tue, Oct 14, 2014 at 11:40 AM, Martin Nilsson (Opera Mini - AFK!) @
Pike (-) importmöte för mailinglistan <[email protected]>
wrote:
>>
>>I thought it was a convention that started in languages like C++,
>>where you tend to write getter/setter methods with the "nice" names,
>>and then adorn the implementation details with underscores.
>>
>
> Maybe. All C++ code I read adheres to code style guides. I know that
> class variables in Python that are prefixed with two underscores will
> become private.

Yes, which is actually a very specific form of name mangling (the
"real" name will have the class name included), and it's actually not
very often used. There's also the "we're all adults here, please don't
use this as it's private" name-only convention of a single underscore.
I'm not sure where either convention actually originated, but I'm
pretty sure they predate Python by quite a bit (and that's in fact why
they were lifted into Python).

ChrisA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.