Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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: UNSURE 0.333 X-Spam-Level: *** X-Spam-Evidence: '*H*': 0.41; '*S*': 0.08; 'python': 0.11; 'def': 0.12; 'keyword,': 0.16; 'keyword.': 0.16; 'pity': 0.16; 'subject:non': 0.16; 'wrote:': 0.18; 'aug': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'skip:p 30': 0.29; 'code': 0.31; 'easier': 0.31; 'too.': 0.31; 'programmers': 0.33; 'something': 0.35; 'but': 0.35; 'subject:skip:d 10': 0.36; "didn't": 0.36; 'subject:?': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'skip:p 20': 0.39; 'even': 0.60; 'remove': 0.60; 'helps': 0.61; 'tag': 0.61; 'name': 0.63; 'here': 0.66; 'protect': 0.79; "else's": 0.84; 'pardon': 0.84; 'received:195.238': 0.84; 'received:195.238.6': 0.84; 'received:belgacom.be': 0.84; 'received:isp.belgacom.be': 0.84; 'stronger': 0.84; 'technically': 0.84; '2013': 0.98 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap8BAABVElJbs80n/2dsb2JhbAANTYZgvF+BOYMYAQEBBDhAEQsYCRYPCQMCAQIBRRMGAgKsJ4oTiAeQYxaDfAOXZJRz Date: Mon, 19 Aug 2013 19:25:45 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130704 Icedove/17.0.7 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Importing variables non-deterministic? References: <520f9054$0$30000$c3e8da3$5496439d@news.astraweb.com> <5211C5BD.5040209@rece.vub.ac.be> <5211D464.5090303@rece.vub.ac.be> <5211DF6C.6030603@rece.vub.ac.be> <52120783.8040008@rece.vub.ac.be> <521231F2.6070407@rece.vub.ac.be> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 19 Aug 2013 19:40:38 +0200 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376934039 news.xs4all.nl 15926 [2001:888:2000:d::a6]:48425 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52701 Op 19-08-13 17:04, Chris Angelico schreef: > On Mon, Aug 19, 2013 at 3:55 PM, Antoon Pardon > wrote: >> Pity enough they chose a >> way that didn't allow programmers to protect names they thought >> important enough to do so too. > > As of Python 3, we can redefine something that used to be a keyword, > which is even stronger than a constant. > > def print(*args,print=print,**kw): > print("##",*args,**kw) > > What easier way to tag all your print calls? And this is why it helps > to have nothing technically constant. You should be able to do the > same with anything, without having to go and edit someone else's code > to remove the 'const' keyword. But what you are showing here is shadowing, not redefintion and you can do that even if the shadowed name would be a constant. -- Antoon Pardon