Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!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; 'debug': 0.03; 'frameworks': 0.04; 'warnings': 0.05; 'prints': 0.07; 'subject:when': 0.07; 'python': 0.08; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'programmer': 0.10; 'case.': 0.15; 'cryptic': 0.16; 'fits': 0.16; 'op.': 0.16; 'patching': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject:builtin': 0.16; 'possibly': 0.16; 'wrote:': 0.16; 'programming': 0.20; 'seems': 0.20; "doesn't": 0.22; 'header:In- Reply-To:1': 0.22; 'int,': 0.23; 'somehow': 0.23; 'libraries': 0.24; "i'm": 0.27; 'somebody': 0.28; 'all,': 0.28; "wasn't": 0.28; 'problem': 0.28; 'lines': 0.30; 'feature,': 0.30; 'if,': 0.30; 'offending': 0.30; 'str': 0.30; 'class': 0.30; 'subject:?': 0.31; "didn't": 0.31; "what's": 0.33; 'it.': 0.33; 'there': 0.33; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'things': 0.34; 'project': 0.34; 'pretty': 0.35; 'uses': 0.35; 'couple': 0.36; 'file': 0.36; 'issue': 0.36; 'response': 0.37; 'using': 0.37; 'but': 0.37; 'think': 0.38; 'patch': 0.38; 'some': 0.38; 'screen': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'under': 0.39; 'logs': 0.39; 'to:addr:python.org': 0.39; 'case': 0.39; "it's": 0.40; 'more': 0.60; 'your': 0.61; 'received:websitewelcome.com': 0.64; 'received:184': 0.67; 'imagine': 0.71; 'circumstance': 0.84; 'problems?': 0.84; 'traceback,': 0.84; 'dozens': 0.91 Date: Tue, 16 Aug 2011 10:48:19 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: python-list@python.org Subject: Re: Why no warnings when re-assigning builtin names? References: <4e49c89a$0$30001$c3e8da3$5496439d@news.astraweb.com> <4e49fcd7$0$29974$c3e8da3$5496439d@news.astraweb.com> <2A3EB048-1F10-46E8-973F-9BBD303E7B9F@semanchuk.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:4206 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 4 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313515920 news.xs4all.nl 23971 [2001:888:2000:d::a6]:33073 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11589 Seebs wrote: > On 2011-08-16, Ethan Furman wrote: >> What makes you think it's unintentional? > > Programming experience. > > People *often* do things unintentionally. > >> Seems to me the real issue is somebody using a builtin, such as str or >> int, and that they somehow manage to do this without realizing, "wait a >> sec', that's one of my variables!" I don't see that as a problem that >> Python needs to solve. > > I think the word "my" prejudices the case. But fits in well with the OP. > Imagine stepping into a large project that uses multiple frameworks and > class libraries and so on. You know Python but you're new to the project. > > Under which circumstance will you have more problems? > > 1. There is not a single shadowed built-in in the entire project. > 2. There are dozens of shadowed built-ins based on when the original > programmer felt there wasn't going to be a need for a given built-in > feature, or possibly just didn't know about it. My first course of action would be to learn what I'm patching before I patch it. Scope helps in the case of shadowing; lint helps to give warnings about that and other things as well. > Also, how easy or hard do you think it will be to debug those problems? > What's your first response going to be if, on a screen which doesn't > contain the word file at all, you try to use the file built-in and you > get some cryptic error? Are you going to know to go looking for the > shadow right away? I should have a pretty good clue from the traceback, and a couple prints or logs around the offending lines should give me the rest. ~Ethan~