Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'skip:[ 20': 0.04; 'namespace': 0.09; 'oh,': 0.09; 'python': 0.11; 'language,': 0.12; '"s"': 0.16; '__builtin__': 0.16; 'builtins': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'underscores,': 0.16; 'wrote:': 0.18; 'first.': 0.19; 'thu,': 0.19; 'import': 0.22; 'sorry,': 0.24; 'tend': 0.24; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'bad.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'running': 0.33; 'skip:_ 10': 0.34; 'knows': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; "he's": 0.36; 'idle': 0.36; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'use.': 0.39; 'to:addr:python.org': 0.39; 'matter': 0.61; 'detail.': 0.68; '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=bOv6/GIRv6dEz9mgx9G+AJQZQMiRmcdbShEt7D4oAMk=; b=VmPSa8Vr7LWeI8czdUDZOVAhF+z1SaNVlGRbRpXJCCxXASixy6zeteiCSAXRi6x4pk CaUgfQDNXRJN96rwdYvKdTvnbo1q1a+ISy+f1ayO5dCuKE/hKJlIUuJ9suueHZOZK8QG GCQzD5YI2KnsNmSrLhNcuwLVDss/YlOzRXhHzXJkrWWXjgoeIYWFWmWwhiltrlOS8wFI e8NPuKNc7GOfdIXBoAi/bQCUQUxr7RUp+oIIpBQNf0Iy/0jkj3/rQZtiC3CGDFbUGhUO usMX/G61jAvgCvjg6vzt37lN5vGqtXMq7/gELnmJFvxFiJ8vjFcJJBVR/qD7OCgfBFR5 UT+g== MIME-Version: 1.0 X-Received: by 10.58.214.105 with SMTP id nz9mr10457013vec.58.1371087002128; Wed, 12 Jun 2013 18:30:02 -0700 (PDT) In-Reply-To: <51b91b89$0$29997$c3e8da3$5496439d@news.astraweb.com> References: <51b69332$0$29997$c3e8da3$5496439d@news.astraweb.com> <51b91b89$0$29997$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 13 Jun 2013 11:30:02 +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: 1371087004 news.xs4all.nl 15875 [2001:888:2000:d::a6]:34195 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47882 On Thu, Jun 13, 2013 at 11:08 AM, Steven D'Aprano wrote: > On Thu, 13 Jun 2013 10:08:14 +1000, Chris Angelico wrote: > >>>>> int="five" >>>>> [__builtins__.int(i) for i in ["1","2","3"]] > > Don't use __builtins__, it's an implementation detail. > > In Python 2.x, there is __builtins__ with an "s" in the global namespace > if you are running CPython, but not necessarily other implementations. > There is __builtin__ with no "s" which is defined by the language, but > you have to import it first. > > In Python 3.x, you just import builtins with an "s" and no underscores, > no matter what implementation you use. Oh, sorry, my bad. I tend to just whip something up in IDLE and see if it works, rather than actually check the spec. Listen to Steven, he knows what he's about! ChrisA