Re: Global variable is undefined at the module level

2019-11-23 Thread Pieter van Oostrum
jacksonhaenc...@gmail.com writes: > This is not accurate. I just tested this in python3 and using the global > keyword allowed me to declare a variable inside the function that was > then visible from the outer scope. What do you mean by that? Anything other than what was said here? > On Tuesday

Re: Global variable is undefined at the module level

2019-11-22 Thread jacksonhaenchen
This is not accurate. I just tested this in python3 and using the global keyword allowed me to declare a variable inside the function that was then visible from the outer scope. On Tuesday, September 13, 2016 at 6:50:39 AM UTC-5, dieter wrote: > Daiyue Weng writes: > > > Hi, I defined a global

Re: Global variable is undefined at the module level

2016-09-13 Thread dieter
Daiyue Weng writes: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level > > How to fix this? You define the global variable at the module level.

Re: Global variable is undefined at the module level

2016-09-13 Thread Ned Batchelder
On Tuesday, September 13, 2016 at 6:42:56 AM UTC-4, Daiyue Weng wrote: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level > > How to fix this?

Re: Global variable is undefined at the module level

2016-09-13 Thread Peter Otten
Daiyue Weng wrote: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level There is no single way to silence that complaint and actually improve y