the global keyword:

Chris Angelico rosuav at gmail.com
Tue Jun 21 18:32:23 EDT 2016


On Wed, Jun 22, 2016 at 8:20 AM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> Then one could have added module-level symbols without all
> the semantic hubbub.
>
>     MSFL.foo = 0
>
>     def iter_foo():
>         MSFL.foo += 1
>

And don't forget that you would need to call this function as
MSFL.iter_foo(). Module-level functions are globals too.

ChrisA



More information about the Python-list mailing list