Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52701

Re: Importing variables non-deterministic?

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 <antoon.pardon@rece.vub.ac.be>
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 <antoon.pardon@rece.vub.ac.be>
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 <a75383ec-b363-4ad4-9703-ca5d8ea614df@googlegroups.com> <520f9054$0$30000$c3e8da3$5496439d@news.astraweb.com> <5211C5BD.5040209@rece.vub.ac.be> <kusidq$kaa$1@ger.gmane.org> <5211D464.5090303@rece.vub.ac.be> <CAPTjJmqvzkuZ8Pmux=K6SSPBeLuDQiD99t7g_pAwujCfb2ON4g@mail.gmail.com> <5211DF6C.6030603@rece.vub.ac.be> <CAPTjJmoATrm+Ke5LNu3zJ-2YppBDqOSTXRP+USwNWrpH64r0sQ@mail.gmail.com> <52120783.8040008@rece.vub.ac.be> <kut3aq$c32$1@ger.gmane.org> <521231F2.6070407@rece.vub.ac.be> <CAPTjJmpwMv9st5EwNfAGGEvwp=M4BYWRQUmm6XK+92LGNHr-OQ@mail.gmail.com>
In-Reply-To <CAPTjJmpwMv9st5EwNfAGGEvwp=M4BYWRQUmm6XK+92LGNHr-OQ@mail.gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.37.1376934039.19984.python-list@python.org> (permalink)
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

Show key headers only | View raw


Op 19-08-13 17:04, Chris Angelico schreef:
> On Mon, Aug 19, 2013 at 3:55 PM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Importing variables non-deterministic? tmellman@googlemail.com - 2013-08-17 07:25 -0700
  Re: Importing variables non-deterministic? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-17 15:01 +0000
    Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 09:14 +0200
    Re: Importing variables non-deterministic? Dave Angel <davea@davea.name> - 2013-08-19 07:45 +0000
    Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 10:16 +0200
      Re: Importing variables non-deterministic? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-19 16:57 +0000
        Re: Importing variables non-deterministic? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-19 17:16 +0000
          Re: Importing variables non-deterministic? Chris Angelico <rosuav@gmail.com> - 2013-08-19 18:25 +0100
        Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 19:40 +0200
    Re: Importing variables non-deterministic? Chris Angelico <rosuav@gmail.com> - 2013-08-19 09:32 +0100
      Re: Importing variables non-deterministic? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-19 17:05 +0000
        Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 22:34 +0200
          Re: Importing variables non-deterministic? Steven D'Aprano <steve@pearwood.info> - 2013-08-20 05:48 +0000
            Re: Importing variables non-deterministic? wxjmfauth@gmail.com - 2013-08-19 23:40 -0700
            Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-20 08:55 +0200
              Re: Importing variables non-deterministic? wxjmfauth@gmail.com - 2013-08-20 00:31 -0700
                Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-20 09:55 +0200
                Re: Importing variables non-deterministic? wxjmfauth@gmail.com - 2013-08-20 02:15 -0700
    Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 11:03 +0200
    Re: Importing variables non-deterministic? Chris Angelico <rosuav@gmail.com> - 2013-08-19 10:18 +0100
    Re: Importing variables non-deterministic? Peter Otten <__peter__@web.de> - 2013-08-19 11:49 +0200
    Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 13:54 +0200
    Re: Importing variables non-deterministic? Dave Angel <davea@davea.name> - 2013-08-19 12:33 +0000
    Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 16:55 +0200
    Re: Importing variables non-deterministic? Chris Angelico <rosuav@gmail.com> - 2013-08-19 16:04 +0100
    Re: Importing variables non-deterministic? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-19 19:25 +0200
    Re: Importing variables non-deterministic? Ben Finney <ben+python@benfinney.id.au> - 2013-08-20 11:14 +1000

csiph-web