Re: Python handles globals badly.

2015-09-16 Thread Antoon Pardon
Op 16-09-15 om 03:13 schreef Steven D'Aprano: > On Mon, 14 Sep 2015 06:30 pm, Antoon Pardon wrote: > >> Op 12-09-15 om 05:48 schreef Steven D'Aprano: >>> I believe I already acknowledged that assignment-as-expression was fine >>> if it avoided the = versus == error, from the perspective of

Re: Python handles globals badly.

2015-09-15 Thread Steven D'Aprano
On Wed, 16 Sep 2015 11:13 am, Steven D'Aprano wrote: > Python is a remarkably clean and consistent language. There's only one > kind of value (the object -- everything is an object, even classes are > objects). The syntax isn't full of special cases. For example, there's > nothing like this

Re: Python handles globals badly.

2015-09-15 Thread Random832
Steven D'Aprano writes: > I don't need to see 23 printed, because I already know what the value is, so > that takes two lines where one would do. (On the rare case I did want to > see the value of something I had just assigned to, I could just print the > expression.) Of

Re: Python handles globals badly.

2015-09-15 Thread Chris Angelico
On Wed, Sep 16, 2015 at 11:20 AM, Steven D'Aprano wrote: > On Wed, 16 Sep 2015 11:13 am, Steven D'Aprano wrote: > >> Python is a remarkably clean and consistent language. There's only one >> kind of value (the object -- everything is an object, even classes are >> objects).

Re: Python handles globals badly.

2015-09-15 Thread Steven D'Aprano
On Mon, 14 Sep 2015 06:30 pm, Antoon Pardon wrote: > Op 12-09-15 om 05:48 schreef Steven D'Aprano: >> I believe I already acknowledged that assignment-as-expression was fine >> if it avoided the = versus == error, from the perspective of avoiding >> errors. But from the perspective of a clean and

Re: Python handles globals badly.

2015-09-14 Thread Skybuck Flying
"Ned Batchelder" wrote in message news:180fe671-7bf9-4544-a3ad-d98a4a497...@googlegroups.com... On Sunday, September 13, 2015 at 8:11:13 AM UTC-4, Skybuck Flying wrote: I don't even understand how python interpreter works but I can understand it better than you guys do apperently hahaha.

Re: Python handles globals badly.

2015-09-14 Thread Antoon Pardon
Op 11-09-15 om 13:59 schreef Marko Rauhamaa: > Antoon Pardon : > >> I just don't get why people want to introduce special cases in python. >> Why allow such a construct only in while and if? Why not just allow >> it generally as an assignment expression? >> >> Why not

Re: Python handles globals badly.

2015-09-14 Thread Antoon Pardon
Op 12-09-15 om 05:48 schreef Steven D'Aprano: > I believe I already acknowledged that assignment-as-expression was fine if > it avoided the = versus == error, from the perspective of avoiding errors. > But from the perspective of a clean and logical programming model, perhaps > not so much.

Re: Python handles globals badly.

2015-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2015 10:04 pm, Skybuck Flying wrote: > " > Namespaces don't "become writeable". > > The purpose of "global" is to tell the compiler that this name should > be bound in the global namespace, not the local namespace. > " > > How does it become writeable then ? It's always

Re: Python handles globals badly.

2015-09-13 Thread Skybuck Flying
" Namespaces don't "become writeable". The purpose of "global" is to tell the compiler that this name should be bound in the global namespace, not the local namespace. " How does it become writeable then ? Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-13 Thread Skybuck Flying
"Steven D'Aprano" wrote in message news:55f566c8$0$1644$c3e8da3$54964...@news.astraweb.com... On Sun, 13 Sep 2015 10:04 pm, Skybuck Flying wrote: " Namespaces don't "become writeable". The purpose of "global" is to tell the compiler that this name should be bound in the global namespace,

Re: Python handles globals badly.

2015-09-13 Thread Skybuck Flying
I may add to that: Just like most programmers don't truely understand what a compiler does ! HAHAHAHAHA. C programmers, Delphi programmers, Java programmers. What python's interpreter is doing same thing, probably completely irrelevant. Except when it comes to making changes to how python

Re: Python handles globals badly.

2015-09-13 Thread Skybuck Flying
"Emile van Sebille" wrote in message news:mailman.433.1442078406.8327.python-l...@python.org... On 9/11/2015 10:22 PM, Skybuck Flying wrote: I didn't learn anything from this posting, sorry ! ;) " I'm seeing a pattern here... " Only thing I might have learned from him was global

Re: Python handles globals badly.

2015-09-13 Thread Skybuck Flying
From what he wrote I can see he's not making much sense... Neither are you. Just lot's of nag and little python related stuff. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-13 Thread Ned Batchelder
On Sunday, September 13, 2015 at 8:11:13 AM UTC-4, Skybuck Flying wrote: > I don't even understand how python interpreter works but I can understand it > better than you guys do apperently hahaha. As tempting as it is to respond to Skybuck, with a brief pause to consider, and a deep breath, I'm

Re: Python handles globals badly.

2015-09-12 Thread Mark Lawrence
On 12/09/2015 17:29, Dennis Lee Bieber wrote: On Sat, 12 Sep 2015 05:11:46 +0100, Mario Figueiredo declaimed the following: On 12-09-2015 03:35, Mark Lawrence wrote: Ada took over from CORAL in the UK, at least in military projects. It was also used in the aircraft

Re: Python handles globals badly.

2015-09-12 Thread MRAB
On 2015-09-12 06:22, Skybuck Flying wrote: "Michael Torrie" wrote in message news:mailman.384.1442016089.8327.python-l...@python.org... On 09/11/2015 03:50 PM, Skybuck Flying wrote: Something which python does not seem to do currently ?! So that's weird. I will leave it at that for now.

Re: Python handles globals badly.

2015-09-12 Thread MRAB
On 2015-09-12 17:29, Dennis Lee Bieber wrote: On Sat, 12 Sep 2015 05:11:46 +0100, Mario Figueiredo declaimed the following: On 12-09-2015 03:35, Mark Lawrence wrote: Ada took over from CORAL in the UK, at least in military projects. It was also used in the aircraft

Re: Python handles globals badly.

2015-09-12 Thread Mario Figueiredo
On 12-09-2015 18:09, MRAB wrote: > On 2015-09-12 17:29, Dennis Lee Bieber wrote: >> But no one had tested the algorithm with the rate of change the >> Ariane >> 5 could produce -- so an algorithm that was developed for, and safe with, >> the smaller Ariane suddenly went "something's wrong --

Re: Python handles globals badly.

2015-09-12 Thread Emile van Sebille
On 9/11/2015 10:22 PM, Skybuck Flying wrote: I didn't learn anything from this posting, sorry ! ;) I'm seeing a pattern here... Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-12 Thread Mark Lawrence
On 12/09/2015 17:24, Dennis Lee Bieber wrote: On Sat, 12 Sep 2015 03:35:00 +0100, Mark Lawrence declaimed the following: Ada took over from CORAL in the UK, at least in military projects. It was also used in the aircraft industry. My old work mates tell me that its

Re: Python handles globals badly.

2015-09-12 Thread Michael Torrie
On 09/11/2015 11:22 PM, Skybuck Flying wrote: > I didn't learn anything from this posting, sorry ! ;) I too am not surprised. You're not here to learn, either about programming language theory, or about Python apparently. I would refer you to a good programming language theory class, but I

Re: Python handles globals badly.

2015-09-12 Thread Chris Angelico
On Sat, Sep 12, 2015 at 4:25 PM, Random832 wrote: > Chris Angelico writes: >> Here. Ned Batchelder explains it better than I can. > > See, those diagrams are perfect (well, almost, I think the names should > have square boxes too). They're arrows. They

Re: Python handles globals badly.

2015-09-12 Thread Steven D'Aprano
On Sat, 12 Sep 2015 01:03 am, Ian Kelly wrote: > On Fri, Sep 11, 2015 at 2:42 AM, Steven D'Aprano > wrote: [...] >> Almost. If it's never assigned within the function, then it is looked up >> according to the non-local scoping rules: >> >> - closures and enclosing functions

Re: Python handles globals badly.

2015-09-12 Thread Chris Angelico
On Sat, Sep 12, 2015 at 3:35 PM, Random832 wrote: > Mark Lawrence writes: >> Let's put it another way, in the 15 years I've been using Python I do >> not recall any experienced Python programmer using "pointer", so what >> makes you think, in

Re: Python handles globals badly.

2015-09-12 Thread Random832
Chris Angelico writes: > Here. Ned Batchelder explains it better than I can. See, those diagrams are perfect (well, almost, I think the names should have square boxes too). They're arrows. They *point* at things. *Pointers*. The boxes are variables. The circles represent

Re: Python handles globals badly.

2015-09-12 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 08.09.2015 16:31, Ian Kelly wrote: > On Tue, Sep 8, 2015 at 5:55 AM, Vladimir Ignatov > wrote: >>> I had some experience programming in Lua and I'd say - that >>> language is bad example to follow. Indexes start with 1 (I

Re: Python handles globals badly.

2015-09-12 Thread Mario Figueiredo
On 12-09-2015 05:38, Mark Lawrence wrote: > > Nothing to do with this being untested software then? Actually it was > so I'd put that down to a programmer error. "The code always worked > before so it's bound to work this time". Such a pity that this > particular launch wasn't the same as

Re: Python handles globals badly.

2015-09-11 Thread Chris Angelico
On Sat, Sep 12, 2015 at 1:57 AM, wrote: > On Fri, Sep 11, 2015, at 11:55, Chris Angelico wrote: >> On Sat, Sep 12, 2015 at 1:49 AM, Ian Kelly wrote: >> > Ah, that makes sense. It's writing into the dict that is created and >> > returned by locals(),

Re: Python handles globals badly.

2015-09-11 Thread Ian Kelly
On Fri, Sep 11, 2015 at 10:04 AM, Chris Angelico wrote: > On Sat, Sep 12, 2015 at 1:57 AM, wrote: >> On Fri, Sep 11, 2015, at 11:55, Chris Angelico wrote: >>> On Sat, Sep 12, 2015 at 1:49 AM, Ian Kelly wrote: >>> > Ah, that makes

Re: Python handles globals badly.

2015-09-11 Thread Rustom Mody
On Friday, September 11, 2015 at 9:27:46 PM UTC+5:30, rand...@fastmail.us wrote: > On Fri, Sep 11, 2015, at 11:55, Chris Angelico wrote: > > On Sat, Sep 12, 2015 at 1:49 AM, Ian Kelly wrote: > > > Ah, that makes sense. It's writing into the dict that is created and > > > returned by locals(), but

Re: Python handles globals badly.

2015-09-11 Thread Skybuck Flying
"Random832" wrote in message news:mailman.242.1441758354.8327.python-l...@python.org... MRAB writes: If you're allowed to specify both bounds, why would you be forbidden from negative ones? " It makes it non-obvious what value should be returned from e.g. search

Re: Python handles globals badly.

2015-09-11 Thread Antoon Pardon
Op 10-09-15 om 16:21 schreef Michael Torrie: > On 09/10/2015 01:27 AM, Antoon Pardon wrote: >> Op 09-09-15 om 19:55 schreef Steven D'Aprano: >>> In fairness to the C creators, I'm sure that nobody back in the early >>> seventies imagined that malware and security vulnerabilities would be as >>>

Re: Python handles globals badly.

2015-09-11 Thread Steven D'Aprano
On Fri, 11 Sep 2015 10:35 am, Ian Kelly wrote: > On Thu, Sep 10, 2015 at 4:25 PM, wrote: [...] >> So the compiler knows the distiction between global and local already. > > As we've said before, it doesn't. The compiler's current rules are > fairly simple: > > 1) If it's in

Re: Python handles globals badly.

2015-09-11 Thread Chris Angelico
On Fri, Sep 11, 2015 at 6:42 PM, Steven D'Aprano wrote: >>> Who is responding or has responded? >>> Extreme Programmers, Python-Hardliner, Python-Evangelists, ... . >>> Presumably no core Python Programmers (wrting compiler and standard >>> library stuff) >> >> Ad hominem. >

Re: Python handles globals badly.

2015-09-11 Thread Rustom Mody
On Friday, September 11, 2015 at 10:04:25 AM UTC+5:30, Marko Rauhamaa wrote: > Ian Kelly : > > > You can use tabs *or* spaces. If you want to mix the two, then there > > would need to be some official decision made about how many spaces > > compose a tab, and then everybody who wants to use tabs

Re: Python handles globals badly.

2015-09-11 Thread tdev
Reflecting latest answers to global and "proposals" Ad hominem. There is a slogan: "There are always two persons involved" This I dont want talk about. I dont go into such a discussion. It seems more a problem of misinterpretations. Proofs. Not really proofs. I meant more or less proofs.

Re: Python handles globals badly.

2015-09-11 Thread Skybuck Flying
Hello, I'll add some arguments to the global discussion for you. First a look back at the origin of this "global" keyword, basically it's idea behind it, which is probably a flawed assumption. The origin/purpose of global as I now understand it is to give "write" access to globally declared

Re: Python handles globals badly.

2015-09-11 Thread MRAB
On 2015-09-11 22:26, t...@freenet.de wrote: Reflecting latest answers to global and "proposals" [snip] But you can say, the "general" sample is: You have to specify global that the compiler can distinguish between local and global Other words: global is needed to distinct global from local.

Re: Python handles globals badly.

2015-09-11 Thread Ian Kelly
On Fri, Sep 11, 2015 at 3:26 PM, wrote: > Ad hominem. > There is a slogan: "There are always two persons involved" > This I dont want talk about. I dont go into such a discussion. > It seems more a problem of misinterpretations. I think you misunderstand my comment. The

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > My favourite analogy for Python names, the sticky note, here > https://mail.python.org/pipermail/tutor/2006-October/049767.html Is player3[3] also a sticky note? Wouldn't the note have to have the id of player3 written on it somehow? Should the

Re: Python handles globals badly.

2015-09-11 Thread Mario Figueiredo
On 12-09-2015 03:35, Mark Lawrence wrote: > > Ada took over from CORAL in the UK, at least in military projects. It > was also used in the aircraft industry. My old work mates tell me that > its completely died a death, to be replaced by C++. Someone please > remind me never to fly again.

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 05:06, Random832 wrote: Mark Lawrence writes: On 12/09/2015 01:11, random...@fastmail.us wrote: If everything in Python is an object, how can it assign a pointer? Especially how do Jython and IronPython assign pointers? The Java and .NET runtimes also

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 05:11, Mario Figueiredo wrote: On 12-09-2015 03:35, Mark Lawrence wrote: Ada took over from CORAL in the UK, at least in military projects. It was also used in the aircraft industry. My old work mates tell me that its completely died a death, to be replaced by C++. Someone

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > How do I access these pointers? Is there a builtin called pointer() > that's analogous to id()? You access them *all the time*. They are the *only* thing you access. But if you want... pointer = lambda x: return x > I'll ask again, where do

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 06:35, Random832 wrote: Mark Lawrence writes: Let's put it another way, in the 15 years I've been using Python I do not recall any experienced Python programmer using "pointer", so what makes you think, in 2015, that you are correct and everybody else is

Terminology: “reference” versus “pointer” (was: Python handles globals badly.)

2015-09-11 Thread Ben Finney
Random832 writes: > Honestly, whether you want to call the thing a pointer or a reference, > you have to call it *something*, and I think "reference" is a worse > fit based on its connotations from C++. Whatever you call it, it's an > arrow on a diagram. With the

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 05:16, Random832 wrote: Mark Lawrence writes: My favourite analogy for Python names, the sticky note, here https://mail.python.org/pipermail/tutor/2006-October/049767.html Is player3[3] also a sticky note? Wouldn't the note have to have the id of

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > I think pointer is even worse because of its connection with C and > hence cPython. What is wrong with object if that is the only thing > Python knows about? Because the object is the *thing the arrow points at*. You don't have two objects when

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 05:34, Random832 wrote: Mark Lawrence writes: I think pointer is even worse because of its connection with C and hence cPython. What is wrong with object if that is the only thing Python knows about? Because the object is the *thing the arrow points

Re: Python handles globals badly.

2015-09-11 Thread Skybuck Flying
"Michael Torrie" wrote in message news:mailman.384.1442016089.8327.python-l...@python.org... On 09/11/2015 03:50 PM, Skybuck Flying wrote: Something which python does not seem to do currently ?! So that's weird. I will leave it at that for now. " Seems to me you have a completely

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 06:07, Random832 wrote: Mark Lawrence writes: How do I access these pointers? Is there a builtin called pointer() that's analogous to id()? You access them *all the time*. They are the *only* thing you access. But if you want... pointer = lambda x:

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > Let's put it another way, in the 15 years I've been using Python I do > not recall any experienced Python programmer using "pointer", so what > makes you think, in 2015, that you are correct and everybody else is > wrong? I still say that

Re: Python handles globals badly.

2015-09-11 Thread Antoon Pardon
Op 10-09-15 om 18:48 schreef Chris Angelico: > I'm not sure what the point would be of having an expression that > doesn't return a value. The point of assignment-as-an-expression is > that you can do other things with the result: > > while ((ch=getchar()) != EOF) > > In Python, we have a couple

Re: Python handles globals badly.

2015-09-11 Thread Marko Rauhamaa
Antoon Pardon : > I just don't get why people want to introduce special cases in python. > Why allow such a construct only in while and if? Why not just allow > it generally as an assignment expression? > > Why not allow: > > while (f(x) as fx) > 5: >

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 10/09/2015 23:25, t...@freenet.de wrote: Some notes to the "global"-keyword and the other proposals. It has been proposed to have these six enhancements 1. optional keyword "global" Won't happen. 2. switch statement Won't happen. 3. less restrictive indentation Won't happen. 4.

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 11/09/2015 03:19, Gene Heskett wrote: On Thursday 10 September 2015 20:33:03 Dennis Lee Bieber wrote: On Thu, 10 Sep 2015 12:04:05 -0700 (PDT), rurpy--- via Python-list declaimed the following: I also doubt there were more programming languages around in the 1970s

Re: Python handles globals badly.

2015-09-11 Thread Gene Heskett
On Friday 11 September 2015 22:35:00 Mark Lawrence wrote: > On 11/09/2015 03:19, Gene Heskett wrote: > > On Thursday 10 September 2015 20:33:03 Dennis Lee Bieber wrote: > >> On Thu, 10 Sep 2015 12:04:05 -0700 (PDT), rurpy--- via Python-list > >> > >> declaimed the

Re: Python handles globals badly.

2015-09-11 Thread Steven D'Aprano
On Fri, 11 Sep 2015 05:28 pm, Antoon Pardon wrote: > Should C have chosen '<-' as token for assignment, that error > would have been far less common. > > The error is also facilitated because C doesn't have booleans > and so everything can be used as one. If C would have had > proper booleans

Re: Python handles globals badly.

2015-09-11 Thread Michael Torrie
On 09/11/2015 03:50 PM, Skybuck Flying wrote: > Something which python does not seem to do currently ?! > > So that's weird. > > I will leave it at that for now. Seems to me you have a completely mistaken understanding of how variables work in Python. This is one of the reasons why I have said

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 01:01, Michael Torrie wrote: On 09/11/2015 03:50 PM, Skybuck Flying wrote: Something which python does not seem to do currently ?! So that's weird. I will leave it at that for now. Seems to me you have a completely mistaken understanding of how variables work in Python. This

Re: Python handles globals badly.

2015-09-11 Thread random832
On Fri, Sep 11, 2015, at 20:01, Michael Torrie wrote: > The secret to understanding the global keyword is to understand how > Python namespaces work. The statement "a=5" does not assign a 5 to the > box called "a." Rather it binds the name "a" to the "5" object, which > is immutable and called

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 12/09/2015 01:11, random...@fastmail.us wrote: On Fri, Sep 11, 2015, at 20:01, Michael Torrie wrote: The secret to understanding the global keyword is to understand how Python namespaces work. The statement "a=5" does not assign a 5 to the box called "a." Rather it binds the name "a" to

Re: Python handles globals badly.

2015-09-11 Thread Michael Torrie
On 09/11/2015 06:11 PM, random...@fastmail.us wrote: > On Fri, Sep 11, 2015, at 20:01, Michael Torrie wrote: >> The secret to understanding the global keyword is to understand how >> Python namespaces work. The statement "a=5" does not assign a 5 to the >> box called "a." Rather it binds the

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 11/09/2015 06:15, Marko Rauhamaa wrote: Chris Angelico : Personally, I like to use tab characters for indentation. You can choose how many pixels or ems or ens or spaces the actual visual shift is, and if I disagree with your choice, it won't affect anything. As long as

Re: Python handles globals badly.

2015-09-11 Thread Mark Lawrence
On 11/09/2015 09:42, Steven D'Aprano wrote: On Fri, 11 Sep 2015 10:35 am, Ian Kelly wrote: On Thu, Sep 10, 2015 at 4:25 PM, wrote: [...] So the compiler knows the distiction between global and local already. As we've said before, it doesn't. The compiler's current rules

Re: Python handles globals badly.

2015-09-11 Thread Random832
Mark Lawrence writes: > On 12/09/2015 01:11, random...@fastmail.us wrote: > If everything in Python is an object, how can it assign a pointer? > Especially how do Jython and IronPython assign pointers? The Java and .NET runtimes also have pointers, they just don't

Re: Python handles globals badly.

2015-09-11 Thread random832
On Fri, Sep 11, 2015, at 03:28, Antoon Pardon wrote: > The error is also facilitated because C doesn't have booleans > and so everything can be used as one. Python does have booleans and everything can be used as one - the logical conclusion is that being able to use everything as a boolean is

Re: Python handles globals badly.

2015-09-11 Thread Ian Kelly
On Fri, Sep 11, 2015 at 2:42 AM, Steven D'Aprano wrote: > On Fri, 11 Sep 2015 10:35 am, Ian Kelly wrote: > >> On Thu, Sep 10, 2015 at 4:25 PM, wrote: > [...] >>> So the compiler knows the distiction between global and local already. >> >> As we've said

Re: Python handles globals badly.

2015-09-11 Thread Chris Angelico
On Sat, Sep 12, 2015 at 1:03 AM, Ian Kelly wrote: >> There's also a bunch of specialised and complicated rules for what happens >> if you make a star import ("from module import *") inside a function, or >> call eval or exec without specifying a namespace. Both of these

Re: Python handles globals badly.

2015-09-11 Thread Ian Kelly
On Fri, Sep 11, 2015 at 9:15 AM, Chris Angelico wrote: > On Sat, Sep 12, 2015 at 1:03 AM, Ian Kelly wrote: >>> There's also a bunch of specialised and complicated rules for what happens >>> if you make a star import ("from module import *") inside a

Re: Python handles globals badly.

2015-09-11 Thread Chris Angelico
On Sat, Sep 12, 2015 at 1:27 AM, Ian Kelly wrote: > The exec still happily runs; it's just using its own private locals namespace. > > Tangent: does the help for exec need to be updated? It currently reads: > > The globals and locals are dictionaries, defaulting to the

Re: Python handles globals badly.

2015-09-11 Thread Ian Kelly
On Fri, Sep 11, 2015 at 9:44 AM, Chris Angelico wrote: > On Sat, Sep 12, 2015 at 1:27 AM, Ian Kelly wrote: >> The exec still happily runs; it's just using its own private locals >> namespace. >> >> Tangent: does the help for exec need to be updated? It

Re: Python handles globals badly.

2015-09-11 Thread random832
On Fri, Sep 11, 2015, at 11:55, Chris Angelico wrote: > On Sat, Sep 12, 2015 at 1:49 AM, Ian Kelly wrote: > > Ah, that makes sense. It's writing into the dict that is created and > > returned by locals(), but not actually updating the frame locals which > > are the source

Re: Python handles globals badly.

2015-09-11 Thread Chris Angelico
On Sat, Sep 12, 2015 at 1:49 AM, Ian Kelly wrote: >> And that's the thing... I think. It's using locals(), which starts out >> as a copy of the function's locals (in this example, empty), but >> without assignment affecting anything. Which is more than a little >> weird: >>

Re: Python handles globals badly.

2015-09-10 Thread Antoon Pardon
Op 09-09-15 om 19:55 schreef Steven D'Aprano: > In fairness to the C creators, I'm sure that nobody back in the early > seventies imagined that malware and security vulnerabilities would be as > widespread as they have become. But still, the fundamental decisions made > by C are lousy. Assignment

Re: Python handles globals badly.

2015-09-10 Thread Marko Rauhamaa
Antoon Pardon : > Op 09-09-15 om 19:55 schreef Steven D'Aprano: >> In fairness to the C creators, I'm sure that nobody back in the early >> seventies imagined that malware and security vulnerabilities would be >> as widespread as they have become. But still, the

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2015 04:23 am, Emile van Sebille wrote: > On 9/9/2015 10:55 AM, Steven D'Aprano wrote: > >> (I wanted to link to the "Everything Is Broken" essay on The Medium, but >> the page appears to be gone. > > Is this it? >

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2015 05:18 am, Chris Angelico wrote: > On Thu, Sep 10, 2015 at 5:14 AM, Laura Creighton wrote: >> In a message of Thu, 10 Sep 2015 05:00:22 +1000, Chris Angelico writes: >>>To get started, you need some other sort of kick. >> >> Having Brian Kernighan write a

Re: Python handles globals badly.

2015-09-10 Thread Michael Torrie
On 09/10/2015 01:27 AM, Antoon Pardon wrote: > Op 09-09-15 om 19:55 schreef Steven D'Aprano: >> In fairness to the C creators, I'm sure that nobody back in the early >> seventies imagined that malware and security vulnerabilities would be as >> widespread as they have become. But still, the

Re: Python handles globals badly.

2015-09-10 Thread jkn
On Thursday, 10 September 2015 13:18:39 UTC+1, Steven D'Aprano wrote: > On Thu, 10 Sep 2015 05:18 am, Chris Angelico wrote: > > > On Thu, Sep 10, 2015 at 5:14 AM, Laura Creighton wrote: > >> In a message of Thu, 10 Sep 2015 05:00:22 +1000, Chris Angelico writes: > >>>To get

Re: Python handles globals badly.

2015-09-10 Thread random832
On Thu, Sep 10, 2015, at 11:59, Steven D'Aprano wrote: > Although, I'm not sure that I agree with the idea that "everything is an > expression". I think that's a category mistake, like asking for the speed > of dark[1], or for a bucket of cold. Some things are functional by > nature, > and other

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2015 04:59 am, random...@fastmail.us wrote: > On Wed, Sep 9, 2015, at 13:55, Steven D'Aprano wrote: >> In fairness to the C creators, I'm sure that nobody back in the early >> seventies imagined that malware and security vulnerabilities would be as >> widespread as they have

Re: Python handles globals badly.

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 2:31 AM, wrote: > On Thu, Sep 10, 2015, at 11:59, Steven D'Aprano wrote: >> Although, I'm not sure that I agree with the idea that "everything is an >> expression". I think that's a category mistake, like asking for the speed >> of dark[1], or for a

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2015 04:26 am, Sven R. Kunze wrote: > Just to understand it the way you want it to be understood: what do you > mean by "technical excellence"? That's one of those things that are difficult to define precisely. All I can do is give some partial examples, and counter-examples.

Re: Python handles globals badly.

2015-09-10 Thread Steven D'Aprano
On Fri, 11 Sep 2015 02:31 am, random...@fastmail.us wrote: > On Thu, Sep 10, 2015, at 11:59, Steven D'Aprano wrote: >> Although, I'm not sure that I agree with the idea that "everything is an >> expression". I think that's a category mistake, like asking for the speed >> of dark[1], or for a

Re: Python handles globals badly.

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 4:13 AM, Steven D'Aprano wrote: > Sometimes they might be. But in general, I think it is meaningless to expect > a imperative command to have a return result. The whole point of an > imperative command is that it operates by side-effect. > > For

Re: Python handles globals badly.

2015-09-10 Thread Ian Kelly
On Thu, Sep 10, 2015 at 4:25 PM, wrote: > with following proofs uncommented: None of these are "proofs". > Each sample provided would work without global > (or you get runtime failure while try to write a global). What samples? It would be easier to follow your messages if

Re: Python handles globals badly.

2015-09-10 Thread tdev
Some notes to the "global"-keyword and the other proposals. It has been proposed to have these six enhancements 1. optional keyword "global" 2. switch statement 3. less restrictive indentation 4. universal scope 5. goto label 6- "include" script statement with following proofs uncommented:

Re: Python handles globals badly.

2015-09-10 Thread MRAB
On 2015-09-11 01:35, Ian Kelly wrote: On Thu, Sep 10, 2015 at 4:25 PM, wrote: [snip] It is correct that there have to be a decision for spaces or tabs. But sure not necessarily the exact same indentation to the right for each block. Jus more same inserter to the right and

Re: Python handles globals badly.

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 6:07 AM, wrote: > On Thu, Sep 10, 2015, at 12:48, Chris Angelico wrote: >> Having assignment be a statement (and therefore illegal in a loop >> condition) makes sense. Having it be an expression that yields a >> useful or predictable value makes

Re: Python handles globals badly.

2015-09-10 Thread Emile van Sebille
On 9/10/2015 3:25 PM, t...@freenet.de wrote: > Who decides it? The BDFL or his delegate. It's simplest that way. Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2015-09-10 Thread Marko Rauhamaa
Chris Angelico : > Personally, I like to use tab characters for indentation. You can > choose how many pixels or ems or ens or spaces the actual visual shift > is, and if I disagree with your choice, it won't affect anything. As > long as tabs are used _exclusively_, Python

Re: Python handles globals badly.

2015-09-10 Thread Marko Rauhamaa
Ian Kelly : > Emacs users with that setup would probably want the Python compiler to > interpret a tab as eight spaces. Which it does: Tabs are replaced (from left to right) by one to eight spaces such that the total number of characters up to and including the

Re: Python handles globals badly.

2015-09-10 Thread Gene Heskett
On Thursday 10 September 2015 20:33:03 Dennis Lee Bieber wrote: > On Thu, 10 Sep 2015 12:04:05 -0700 (PDT), rurpy--- via Python-list > > declaimed the following: > >I also doubt there were more programming languages around in the > >1970s than now, on the grounds that

Re: Python handles globals badly.

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 3:15 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> Personally, I like to use tab characters for indentation. You can >> choose how many pixels or ems or ens or spaces the actual visual shift >> is, and if I disagree with your choice,

Re: Python handles globals badly.

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 2:34 PM, Marko Rauhamaa wrote: > etc. The TAB *key* is a command that makes emacs indent with a mix of > spaces and TABs. I don't care how you key them in. If your tab key moves you to the next position, that's good. If you convert a sequence of N spaces

Re: Python handles globals badly.

2015-09-10 Thread Marko Rauhamaa
Ian Kelly : > You can use tabs *or* spaces. If you want to mix the two, then there > would need to be some official decision made about how many spaces > compose a tab, and then everybody who wants to use tabs would have to > configure their editors to conform to that

Re: Python handles globals badly.

2015-09-10 Thread Ian Kelly
On Thu, Sep 10, 2015 at 10:34 PM, Marko Rauhamaa wrote: > Ian Kelly : > >> You can use tabs *or* spaces. If you want to mix the two, then there >> would need to be some official decision made about how many spaces >> compose a tab, and then everybody who

Re: Python handles globals badly.

2015-09-10 Thread alister
On Fri, 11 Sep 2015 01:59:27 +1000, Steven D'Aprano wrote: > > Although, I'm not sure that I agree with the idea that "everything is an > expression". I think that's a category mistake, like asking for the > speed of dark[1], or for a bucket of cold. Some things are functional by > nature, and

  1   2   3   >