Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '"if': 0.04; 'builtins': 0.07; 'subject:when': 0.07; 'terry': 0.07; 'append': 0.09; 'trailing': 0.09; '16,': 0.15; 'builtins.': 0.16; 'bye': 0.16; 'clashes': 0.16; 'code?': 0.16; 'curious,': 0.16; 'keyword,': 0.16; 'received:mindspring.com': 0.16; 'reedy': 0.16; 'semanchuk': 0.16; 'subject:builtin': 0.16; 'terry,': 0.16; 'underscore': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; 'wrote:': 0.16; '(perhaps': 0.18; 'header:In-Reply-To:1': 0.22; 'thus': 0.23; 'referring': 0.23; 'pm,': 0.24; 'variable': 0.24; 'aug': 0.24; 'expect': 0.25; 'saying': 0.26; 'function': 0.27; 'specifically': 0.29; 'spelling': 0.30; 'subject:?': 0.31; "didn't": 0.31; 'received:24': 0.32; 'generally': 0.32; 'there': 0.33; 'to:addr :python-list': 0.33; 'be.': 0.34; 'rather': 0.35; 'anything': 0.36; 'charset:us-ascii': 0.36; 'example,': 0.37; 'using': 0.37; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'might': 0.40; 'your': 0.61; 'header:Message-Id:1': 0.61; 'received:69.73': 0.84 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Why no warnings when re-assigning builtin names? From: Philip Semanchuk In-Reply-To: Date: Tue, 16 Aug 2011 22:51:01 -0400 Content-Transfer-Encoding: quoted-printable References: <4e49c89a$0$30001$c3e8da3$5496439d@news.astraweb.com> <4e49fcd7$0$29974$c3e8da3$5496439d@news.astraweb.com> <5E204ED4-4008-416F-9C5F-DDCDCF6077D3@semanchuk.com> To: python-list list X-Mailer: Apple Mail (2.1084) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - deimos.nocdirect.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - semanchuk.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313549469 news.xs4all.nl 23884 [2001:888:2000:d::a6]:60686 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11652 On Aug 16, 2011, at 10:15 PM, Terry Reedy wrote: > On 8/16/2011 8:18 PM, Philip Semanchuk wrote: >=20 >> Hi Terry, >> To generalize from your example, are you saying that there's a mild = admonition > > against shadowing builtins with unrelated variable names in standard = lib code? >=20 > I would expect that there might be. I would have to check PEP8. I was curious, so I checked. I didn't see anything specifically = referring to builtins. This is as close as it gets: "If a function argument's name clashes with a reserved keyword, it is = generally better to append a single trailing underscore rather than use = an abbreviation or spelling corruption. Thus "print_" is better than = "prnt". (Perhaps better is to avoid such clashes by using a synonym.)" bye Philip