Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assign': 0.04; 'names.': 0.07; 'subject:when': 0.07; 'variable,': 0.07; 'python': 0.08; '__future__': 0.09; '(eg.': 0.16; 'directive': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:builtin': 0.16; 'surprising': 0.16; 'mon,': 0.16; 'wrote:': 0.16; 'issue.': 0.19; 'header:In-Reply-To:1': 0.22; 'pm,': 0.24; 'aug': 0.24; 'import': 0.28; 'script.': 0.29; 'message-id:@mail.gmail.com': 0.29; 'remains': 0.30; 'subject:?': 0.31; 'list': 0.32; 'it.': 0.33; 'actually': 0.33; 'to:addr :python-list': 0.33; 'example,': 0.37; 'but': 0.37; 'something': 0.37; 'some': 0.38; 'received:google.com': 0.38; '8bit%:8': 0.38; 'received:209.85': 0.38; 'easier': 0.38; 'subject:: ': 0.39; 'skip:\xa0 10': 0.39; 'to:addr:python.org': 0.39; "i'd": 0.40; "it's": 0.40; 'charset:windows-1252': 0.60; 'harder': 0.64; 'postings': 0.64; '10:52': 0.84; 'masking,': 0.84; 'regularity,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=KVbbf8a62s/Xeiw4PCNtmZ1e2hVvgj98EfcjGKioZik=; b=hrYcE+IHj4pCtYfsPwjl9AIkaJogxBlBtZaVIfOzwPwBy1vCgJeBp1OQ/D2W5Bb6qa eNiWUrq2h0YRvNCyL/SctN4BKba9Q3Uy0AuIbbHHKFIrLSxcLGIvB7u3IemuAdOrwD+3 YAfLVtipcZKMXpBDwX7LSlIqX7N1lsIdnrfvo= MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 15 Aug 2011 23:15:01 +0100 Subject: Re: Why no warnings when re-assigning builtin names? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313446504 news.xs4all.nl 23942 [2001:888:2000:d::a6]:35965 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11476 On Mon, Aug 15, 2011 at 10:52 PM, Gerrat Rickert wrote: > With surprising regularity, I see program postings (eg. on StackOverflow) > from inexperienced Python users =A0accidentally re-assigning built-in nam= es. > > For example, they=92ll innocently call some variable, =93list=94, and ass= ign a > list of items to it. It's actually masking, not reassigning. That may make it easier or harder to resolve the issue. If you want a future directive that deals with it, I'd do it the other way - from __future__ import mask_builtin_warning or something - so the default remains as it currently is. But this may be a better job for a linting script. ChrisA