Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'attributes': 0.07; 'interpreter.': 0.07; '__init__': 0.09; 'python': 0.11; 'url:pep-0008': 0.16; 'wrote:': 0.16; 'documented': 0.18; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'developers': 0.24; 'mon,': 0.24; 'url:dev': 0.27; 'message-id:@mail.gmail.com': 0.28; 'pep': 0.29; 'url:peps': 0.29; 'objects': 0.29; 'anywhere': 0.30; 'e.g.': 0.31; 'core': 0.32; 'url:python': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'received:google.com': 0.34; 'skip:_ 40': 0.34; 'to:addr:python-list': 0.35; 'url:org': 0.36; 'so,': 0.37; 'should': 0.37; 'subject:: ': 0.37; 'pm,': 0.39; 'unable': 0.39; 'url:docs': 0.39; 'to:addr:python.org': 0.39; 'url:3': 0.60; 'skip:u 10': 0.62; 'apart': 0.70; 'to:name:python': 0.84; 'url:reference': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=5kGDmH0LVI5sy8rHYyGqdT38OAV878qxCqoc8oisu1Y=; b=PMPz2zkIm6IT2NZQH7GOOQS+vjiO94tDXSIHH8hLzWhb76GEafe0M44y6lgMFxVNZ7 M+6gzXbvzwpQWo8woTyV5vCmQaQSp2Ls3yEAekIwEIZIaY8fwmR63Ig+lsCBEmMciE4x FuKLmwvXM63EOChzp+zYaM6Za/3R4PnKWz6sXdXtuq2C2R3EsvXr68wHlF3KKc+R3LPH pG2Ek5bSECr32eg+pf+9tF4ZGcrjonuI+ZVReWBxA8hj3uz19yE0T7fD14CO/Y/fBtH9 ArCk5cXoZOnu14a6i2lYaoVVpbnb2/mV4gUoSBAAeqWVGJwsZ+6h0FsvtLs0EomLiZgg rY+Q== X-Received: by 10.42.226.8 with SMTP id iu8mr27225423icb.17.1432614931817; Mon, 25 May 2015 21:35:31 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5563d7bb$0$12982$c3e8da3$5496439d@news.astraweb.com> References: <5563d7bb$0$12982$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Mon, 25 May 2015 22:34:51 -0600 Subject: Re: Documentaion of dunder methods To: Python Content-Type: text/plain; charset=UTF-8 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: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432614940 news.xs4all.nl 2910 [2001:888:2000:d::a6]:35362 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3881 X-Received-Body-CRC: 2447553776 Xref: csiph.com comp.lang.python:91227 On Mon, May 25, 2015 at 8:17 PM, Steven D'Aprano wrote: > PEP 8 states that developers should never invent their own dunder methods: > > __double_leading_and_trailing_underscore__ : > "magic" objects or attributes that live in user-controlled > namespaces. E.g. __init__ , __import__ or __file__ . Never > invent such names; only use them as documented. > > https://www.python.org/dev/peps/pep-0008/#naming-conventions > > > In other words, dunder methods are reserved for use by the core developers > for the use of the Python interpreter. > > Apart from PEP 8, is this documented anywhere in the official documentation? > If so, I have been unable to find it. https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers