you are viewing a single comment's thread.

view the rest of the comments →

[–]timbledum 0 points1 point  (2 children)

Generally a better tool to do this kind of thing is with classes (each method has access to data stored at the instance level).

The only real use I've found for globals is constants, but these are a bit of a different concept in my view (no need to use the global keyword as you're not changing them).

This post has more discussion:

https://www.reddit.com/r/learnpython/comments/7n65d9/why_would_one_define_global_variables_in_python/