What use of these _ prefix members?
me
self at example.org
Tue Jan 12 09:12:06 EST 2016
On 2016-01-10, Peter Otten <__peter__ at web.de> wrote:
>>>> class Derived(Base):
> ... def _init(self, x):
> ... super()._init(x)
> ... print("do something else with", x)
> ...
>>>> Derived(42)
> do something with 42
> do something else with 42
><__main__.Derived object at 0x7f8e6b3e9b70>
>
I think you are doing inheritance wrong.
AFAIK you should call directly the __init__() of the parent class, and
pass *args and **kwargs instead.
Except for that, yes, the _init would be conventionally private. Not
enforced by name mangling though.
More information about the Python-list
mailing list