Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'class,': 0.07; 'raises': 0.07; 'python': 0.09; 'builtins': 0.09; 'friday,': 0.09; 'funny,': 0.09; 'imports': 0.09; 'len,': 0.09; 'namespace': 0.09; 'repr': 0.09; 'symbols': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; ';-)': 0.11; 'programmer': 0.11; 'properly': 0.15; 'identifiers.': 0.16; 'merely': 0.16; 'namespace.': 0.16; 'symbol,': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'examples': 0.18; 'feb': 0.19; 'module': 0.19; 'variable': 0.20; 'import': 0.21; 'basis,': 0.22; 'skip:_ 20': 0.22; 'cc:2**0': 0.23; 'purposes': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'looks': 0.26; 'module.': 0.27; 'chris': 0.28; 'block,': 0.29; 'things,': 0.29; 'fri,': 0.30; '(2)': 0.32; 'johnson': 0.32; 'qualify': 0.33; 'received:google.com': 0.34; '(1)': 0.34; 'built-in': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'explain': 0.36; 'serve': 0.36; 'tool': 0.36; 'but': 0.36; 'should': 0.36; 'does': 0.37; 'level': 0.37; 'two': 0.37; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'list,': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'think': 0.40; 'your': 0.60; 'you.': 0.61; 'containing': 0.61; 'skip:a 40': 0.61; 'first': 0.61; 'side': 0.61; 'making': 0.64; 'total': 0.65; 'detail.': 0.65; 'skip:n 40': 0.72; 'funny': 0.78; '2013': 0.84; 'encounters': 0.84; 'laughed': 0.84; 'qualified:': 0.84; 'received:209.85.220.184': 0.91; 'rick': 0.91 X-Received: by 10.49.12.238 with SMTP id b14mr381405qec.18.1360308227834; Thu, 07 Feb 2013 23:23:47 -0800 (PST) Newsgroups: comp.lang.python Date: Thu, 7 Feb 2013 23:23:47 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.110.35; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj References: <02ced8e2-5967-4ce0-b257-83c3a3fbaf8e@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 70.196.110.35 MIME-Version: 1.0 Subject: Re: PyWart: Namespace asinitiy and the folly of the global statement From: Rick Johnson To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org 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: , Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360308236 news.xs4all.nl 6984 [2001:888:2000:d::a6]:42438 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38428 On Friday, February 8, 2013 12:25:34 AM UTC-6, Chris Angelico wrote: > On Fri, Feb 8, 2013 at 3:30 PM, Rick Johnson wrote: > > It is my strong opinion that all "unqualified" variables must be local = to the containing block, func/meth, class, or module. To access any variabl= e outside of the local scope a programmer MUST qualify that variable with t= he func, class, or module identifiers. Consider the following examples >=20 > Okay. Now start actually working with things, instead of just making > toys. All your builtins now need to be qualified: =20 Chris you are very trollish, and a total tool of Deaprano, but you are damn= funny sometimes and for that reason i still respond to you. ;-) > __builtins__.print("There > are",__builtins__.len(self.some_list),"members in this list, > namely:",__builtins__.repr(self.some_list)) That's funny, and i laughed whilst reading it, but i do have to admit that = i did not explain this detail. IMHO, all builtins should not be auto-import= ed, the programmer should import them either on a case by case basis, or do= the global import: from builtins import print, len, repr from builtins import * # This is not recommended! This would serve two purposes (1) the reader would know which builtins wher= e being used in this module (2) the names would be bound properly to the mo= dule namespace. But this does not answer your question, merely a side note So your assertion is wrong. Built-ins /would/ be available at the module le= vel with no qualification just as they are now. But they would also be avai= lable in /every/ namespace because how else would we use them Chris?=20 It's very simple, when python encounters a unqualified symbol, it looks fir= st for a match in the built-in symbols array, and if not match is found it = then raises a NameError. > Or are you going to make builtins and imports magically available as > PHP-style superglobals? Hmm, what are they now Chris? Python built-ins are known everywhere without= qualification and require no import. I think super-global about sums it up= .