Python handles globals badly.

Ian Kelly ian.g.kelly at
Thu Sep 3 21:51:56 CEST 2015

On Thu, Sep 3, 2015 at 1:47 PM, Ian Kelly <ian.g.kelly at> wrote:
> On Thu, Sep 3, 2015 at 1:05 PM,  <tdev at> wrote:
>> But then I ask you from high-level point of view
>> (if my high level view is correct at all):
>> Would you remove this keyword if it would be technically possible
>> or is good for you from high level point of view to have a keyword "global"?
> Provided that the proposal doesn't open up the possibility of
> unintentionally creating a global variable where I wanted a local, I'd
> be okay with it.

Let me clarify that I'd be okay with making the keyword optional. It
should probably still be kept around for the occasional use like this:

exec("""def function():
    global {0}
    {0} = 42

where the compiler would have little hope of figuring out that the
variable was meant to be global without it.

More information about the Python-list mailing list