Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52682
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: Importing variables non-deterministic? |
| Date | 2013-08-19 11:49 +0200 |
| Organization | None |
| References | (3 earlier) <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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.21.1376905752.19984.python-list@python.org> (permalink) |
Chris Angelico wrote: > On Mon, Aug 19, 2013 at 10:03 AM, Antoon Pardon > <antoon.pardon@rece.vub.ac.be> wrote: >> This is irrelevant. That some context defines a constant, and that you >> can use a variable with the same name as a constant in python, doesn't >> contradict the statement that python (as a language) doesn't has >> constants. There is nothing in the language that would prevent buggy >> code from changing any of those variables. So from a python point of >> views these are just global variables. Just as the struct_global.y was >> in the original contribution. > > And there's nothing preventing a program from using ctypes to > overwrite an object's refcount, thus causing a segfault. So? The issue > was regarding imports, and it's perfectly safe to import a constant, > even if the interpreter doesn't protect you from then being a total > idiot and changing it. Come on, breaking a "gentlemen's agreement" by rebinding a name and using ctypes to manipulate the internal state of the cpython imlementation are very different things. If that proves anything I'll best you with a Python script that controls a robot which in turn destroys the computer running the script with a hammer ;) If Antoon's point is that global "constants" in Python are only constants because the programmer thinks of them that way I'd say that's an important addition to put Steve's "global variables are considered harmful" into perspective.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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