Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Re: What use of these _ prefix members? Date: Sun, 10 Jan 2016 19:34:52 +0100 Organization: None Lines: 27 Message-ID: References: <4ee5810e-abe9-4c4b-9ebd-d989b5c2b341@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de uik4a8ldfhc9AY7eBrn7BAU1ZNwgN42eFsdViwR/42ng== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'caller': 0.07; 'caller.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:members': 0.09; 'example:': 0.10; 'package,': 0.13; 'def': 0.13; "'_')": 0.16; '(prefix': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'scikit- learn': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:_ 10': 0.32; 'class': 0.33; 'file': 0.34; 'functions.': 0.35; 'robert': 0.35; 'subject:use': 0.35; 'something': 0.35; 'there': 0.36; 'to:addr :python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'anything': 0.38; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'sample': 0.63; 'x):': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd8c3f.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101444 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>