Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101444

Re: What use of these _ prefix members?

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: What use of these _ prefix members?
Date 2016-01-10 19:34 +0100
Organization None
Message-ID <mailman.7.1452450908.3151.python-list@python.org> (permalink)
References <4ee5810e-abe9-4c4b-9ebd-d989b5c2b341@googlegroups.com>

Show all headers | View raw


Robert wrote:


> When I read a sample file from hmm learn package, which is on top of
> scikit-learn package, I see there are many member functions (prefix with
> '_') have no caller. That is, I don't see anything uses those functions.
> Below is a sample part from class GMMHMM(_BaseHMM):

I bet the caller is in the superclass _BaseHMM, like in the following made-
up example:

>>> class Base:
...     def __init__(self, x):
...         self._init(x)
...     def _init(self, x): print("do something with", x)
... 
>>> 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>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What use of these _ prefix members? Robert <rxjwg98@gmail.com> - 2016-01-10 09:55 -0800
  Re: What use of these _ prefix members? Steven D'Aprano <steve@pearwood.info> - 2016-01-11 05:03 +1100
  Re: What use of these _ prefix members? Peter Otten <__peter__@web.de> - 2016-01-10 19:34 +0100
    Re: What use of these _ prefix members? me <self@example.org> - 2016-01-12 14:12 +0000
      Re: What use of these _ prefix members? Peter Otten <__peter__@web.de> - 2016-01-12 15:52 +0100
      Re: What use of these _ prefix members? Jason Swails <jason.swails@gmail.com> - 2016-01-12 10:01 -0500

csiph-web