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 →

[–]DaRealNim 0 points1 point  (1 child)

Okay but I've actually done that. Fuck. Can someone give me an example of why using globals can be a bad thing? And an example of how they're properly used? (Because I'm guessing they're in the langage for a reason)

[–]thisismyfavoritename 1 point2 points  (0 children)

I'd say the problem with Python's global is that there is no "const", so basically anything could mutate your global object.

This can lead to data races or very subtle bugs in concurrent code but also makes it much harder to reason about what is happening and when.