On Tue, Jul 25, 2017 at 8:43 AM, Chris Angelico <ros...@gmail.com> wrote: > > I'm not actually sure what happens if you use a global declaration at > top level. Is it ignored? Is it an error?
It isn't ignored, but it shouldn't make a difference since normally at module level locals and globals are the same. It makes a difference in an exec() that uses separate locals and globals dicts. For example: >>> exec('print(x)', {'x':'G'}, {'x':'L'}) L >>> exec('global x; print(x)', {'x':'G'}, {'x':'L'}) G -- https://mail.python.org/mailman/listinfo/python-list