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


Groups > comp.lang.python > #52701

Re: Importing variables non-deterministic?

Date 2013-08-19 19:25 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Subject Re: Importing variables non-deterministic?
References (7 earlier) <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>
Newsgroups comp.lang.python
Message-ID <mailman.37.1376934039.19984.python-list@python.org> (permalink)

Show all headers | 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