Why this doesn't work?
mk
mrkafk at gmail.com
Fri Feb 19 09:39:04 EST 2010
Steven D'Aprano wrote:
> On Thu, 18 Feb 2010 18:28:44 +0100, mk wrote:
>
>> nostat.__orig_get__ = nostat.__get__
>
> I should point out that leading-and-trailing-double-underscore names are
> reserved for use by the language.
Right... I completely missed that. I will try to change the habit.
I am under impression that a function with no underscore in name is
meant to be called "publicly" on instance, like Foo().nostat, a function
with one underscore (and no trailing underscores) is meant to be like
"it's mostly intended for internal use, but you can still call it",
somewhat like "protected" in C++, and a function with two leading
underscores (and no trailing underscores) is meant as completely
internal to the class, not meant to be called by outsiders, somewhat
like "private" in C++ (I abstract from obvious point in C++ that
semantics of those keywords is enforced by a compiler in C++).
Is that correct?
Regards,
mk
More information about the Python-list
mailing list