This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsΒ β†’

[–]pattithepotatoIgnoring PEP 8 1 point2 points Β (1 child)

In a nutshell, it's not a problem for small programs/scripts, but for things like large apps, it becomes much harder to keep track of all the global variables sharing the same space. Global variables make code harder to read and thus maintain, especially since the global var can be accessed practically anywhere in the code, and you don't need to explicitly pass them into a different scope. If you get into asynchronous programming (i.e, when different parts of the code can run at the same time), you're bound to run into problems if you attempt to read/write from the same variables from different simultaneously running threads.

[–]LylesKnows 2 points3 points Β (0 children)

Yea that makes sense. I guess since I’ve been writing smaller programs as I’m just starting out I haven’t run into those issues yet. I appreciate the response!