Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'python': 0.11; '__builtin__': 0.16; '_int': 0.16; 'builtins': 0.16; 'callable': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'typeerror:': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'import': 0.22; 'skip': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '"",': 0.31; '13,': 0.31; '>>>>': 0.31; 'file': 0.32; '(most': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'recent': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'name:': 0.61; 'different': 0.65; 'habit': 0.91; '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=4ZUPYpm3rP/2Kc11sXqNrgSM+nQgzbo18UCUFQ8kldA=; b=LNprlMMpHBlY8D7MfhlKDeG+6NzEgjfA+kq6vRrh4FFBitWWN64bcG7b9phPp22Vys z6CJEnX2cSWcwVmnAMHqrk8UkKiuXZfyJvNLSmTMmstL9ShmGPHgH4G+IY6rslgzpLo3 CvrfCS5xnn+9QOZW9iBzKXwYRNVroxNQeZWM2DsaLs2ogwPkqIK1YR8eAl4nJMVpaP+n L36nAOxEHeu4vA1fdfwpkGOwIIiC2iDuWaIMQJ192C8Ucg1up4Nm/lCrPWhahKa+gm/q 5tSj+VR4NY66/tduc7vke+5BND+hJ7nbouTOPEfqOaLVnJn+v4Ms+/+tlG8bvDcfL+pV 0d6w== MIME-Version: 1.0 X-Received: by 10.52.164.163 with SMTP id yr3mr8970182vdb.76.1371083612074; Wed, 12 Jun 2013 17:33:32 -0700 (PDT) In-Reply-To: References: <51b69332$0$29997$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 13 Jun 2013 10:33:31 +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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371083614 news.xs4all.nl 15990 [2001:888:2000:d::a6]:55327 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47872 On Thu, Jun 13, 2013 at 10:18 AM, Skip Montanaro wrote: > Magic. :-) > >>>> int = "five" >>>> int("a") > Traceback (most recent call last): > File "", line 1, in > TypeError: 'str' object is not callable >>>> from __builtin__ import int as _int >>>> _int("5") > 5 > > Not sure of the magic necessary in Python 3. This is definitely > something you don't want to make a habit of... Same thing works but with a different name: from builtins import int as _int ChrisA