Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'works.': 0.07; 'python': 0.09; 'underscore': 0.09; 'url:github': 0.09; '*can*': 0.16; 'semantically': 0.16; 'wrote:': 0.17; 'define': 0.20; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'convention': 0.27; 'in.': 0.27; 'skip:@ 10': 0.27; "doesn't": 0.28; 'class': 0.29; 'function': 0.30; 'received:209.85.160.46': 0.32; 'accessible': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'message-id:@gmail.com': 0.36; 'method': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'nothing': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'truly': 0.62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=rce1Ugzo3kTYH0p6kIE8dnCo/lFN4EyLNwl/GGtmy3A=; b=VD9AXk6FK46yr1uCo0p7ENd2O+Ap4is9trRMiTVl5TIbmxduJkErpX9XpUDK+SXSTe jHoZLnUaquOXr4N/7j7gxlK+ow8LrU4grWGpxJDj7Q5LtEQ0VXOvkl9jvobITBkGBMXo Aml/hIpgvPnQ8ztirSfTovSpELlMgRW8q/1wNqQtaVic0NT4xy+iFv5aDBaF2O74ZaNn kGr1ZR9cD4DbzuOiaRoo2Bep4sIqZXclfpcpEZjDfS70MNFHaFghIpXJEc8vlkB8bX0d nqbXHVqLeiXpoNwKPyCN1qw9nFgN+f0euBXFH1X66uqixXm68HQ3LPt9xK8+Y+vRpdAp zXZg== Date: Tue, 09 Oct 2012 07:08:20 -0700 From: Demian Brecht User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Private methods References: <1krpbz9.1wge3j11123k2vN%real-not-anti-spam-address@apple-juice.co.uk> <1krpdak.u0qy9e1a4knspN%real-not-anti-spam-address@apple-juice.co.uk> In-Reply-To: <1krpdak.u0qy9e1a4knspN%real-not-anti-spam-address@apple-juice.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349791707 news.xs4all.nl 6892 [2001:888:2000:d::a6]:33153 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31023 On 12-10-09 06:59 AM, D.M. Procida wrote: > In Python, using an underscore is simply a convention to note that a > method is private - it doesn't actually hide it from other things - > correct? > > Daniele > A single underscore semantically means private. A double underscore will name mangle the function such that it's only accessible strictly by name through the class that it's define in. Note that you *can* still access it if you understand how name mangling works. Nothing in Python is truly private. -- Demian Brecht @demianbrecht http://demianbrecht.github.com