Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.030 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.01; 'skip:[ 20': 0.04; '[1,': 0.09; 'callable': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'janssen': 0.16; 'namespace,': 0.16; 'really?': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'module': 0.19; 'thu,': 0.19; '>>>': 0.22; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; '>>>>': 0.31; 'received:google.com': 0.35; 'skip:[ 10': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'name:': 0.61; 'qualified': 0.72; 'back?': 0.84; 'subject:Don': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YaQHY3oQVhBjig1xvFLoUZG/PMJrNil6scuLforkylQ=; b=IvVulDWumdwH09UdHHX88ou16VA2RPOyDD/xapwqxsJagqSiSRdDRp741R1JOiQx5a j8ncsqC2283Pua4zFn+BMTO3kdpeMuVI/mataYyz9SjqLZLTXdls1zY7zXz15ginAsPs v3ao2x5z5J1gShozVN1tgDgAMOiBZmU6RWW5tLyvuyJU/17gKanNurtLOFVWauvwn8MN zSA9nwz9OLOB9xlgonmmoUgQ0c82sKqA686ARTdj0M37QshimOmoUO25S7vSyR734dFN 9ZvXW7eWmdP3ivdoWSaHE6h8GwqbyQp2g71zAeDLkFpfQ+D3P8VPMCyvbUDvh/rS3xn4 x23Q== MIME-Version: 1.0 X-Received: by 10.220.109.66 with SMTP id i2mr10530960vcp.51.1371082094145; Wed, 12 Jun 2013 17:08:14 -0700 (PDT) In-Reply-To: References: <51b69332$0$29997$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 13 Jun 2013 10:08:14 +1000 Subject: Re: "Don't rebind built-in names*" - it confuses readers From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371082102 news.xs4all.nl 15974 [2001:888:2000:d::a6]:58219 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47865 On Thu, Jun 13, 2013 at 10:04 AM, Mark Janssen wrote: > Really? > >>>> int="five" >>>> [int(i) for i in ["1","2","3"]] > TypeError: str is not callable > > Now how are you going to get the original int type back? Either del it from your module namespace, or use the qualified name: >>> int="five" >>> [__builtins__.int(i) for i in ["1","2","3"]] [1, 2, 3] >>> del int >>> [int(i) for i in ["1","2","3"]] [1, 2, 3] It's shadowed, not overwritten. ChrisA