Re: a clarification on the "global" statement sought

2016-03-11 Thread Chris Angelico
On Fri, Mar 11, 2016 at 8:09 PM, Charles T. Smith wrote: > "Python deals with variables the other way around. >They are local, if not otherwise declared. >... > def f(): > print(s) > s = "I love Paris in the summer!" > f() > ... >

Re: a clarification on the "global" statement sought

2016-03-11 Thread Peter Otten
Charles T. Smith wrote: > On Fri, 11 Mar 2016 19:29:20 +1100, Chris Angelico wrote: > >> Usefully? Never. >> >> Simple question - simple answer :) >> >> ChrisA > > > Right, that was the expected answer as well. I just ran into that in > legacy code, checked out the documentation and

Re: a clarification on the "global" statement sought

2016-03-11 Thread eryk sun
On Fri, Mar 11, 2016 at 2:13 AM, Charles T. Smith wrote: > When might a "global" statement be used in the outermost level of a module? You wouldn't need this in a normal module, because locals and globals are the same. It may be useful if you're using exec with

Re: a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 08:31:22 +, Mark Lawrence wrote: > Never. Hopefully this > http://www.python-course.eu/python3_global_vs_local_variables.php can > explain it better than I can :) The article is good, I'm glad to have confirmed what I have so empirical stumbled over. ... Irrespective of

Re: a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 19:29:20 +1100, Chris Angelico wrote: > Usefully? Never. > > Simple question - simple answer :) > > ChrisA Right, that was the expected answer as well. I just ran into that in legacy code, checked out the documentation and couldn't really make that out. So I figured I

Re: a clarification on the "global" statement sought

2016-03-11 Thread Mark Lawrence
On 11/03/2016 08:13, Charles T. Smith wrote: When might a "global" statement be used in the outermost level of a module? Never. Hopefully this http://www.python-course.eu/python3_global_vs_local_variables.php can explain it better than I can :) (whereby, I assume a module is equivalent

Re: a clarification on the "global" statement sought

2016-03-11 Thread Chris Angelico
On Fri, Mar 11, 2016 at 7:13 PM, Charles T. Smith wrote: > When might a "global" statement be used in the outermost level of a module? > > (whereby, I assume a module is equivalent to a python file, correct?) > Usefully? Never. Simple question - simple answer :)

a clarification on the "global" statement sought

2016-03-11 Thread Charles T. Smith
When might a "global" statement be used in the outermost level of a module? (whereby, I assume a module is equivalent to a python file, correct?) TIA for any thoughts. cts -- https://mail.python.org/mailman/listinfo/python-list