Python Global Vars are Persistent

I was working on my new Python project, a wiki, and was having problems where my code wasn’t being interpreted more than once, or so I thought. I had a menu that changes depending on if the user is authenticated or not, except it never changed. I was on FreeNode IRC’s Django support channel (#django) and was informed that variables declared in the global scope are persistent across requests, as well as exhibiting other quirky behavior. Just thought I’d share this with everyone else in case you ever have this issue.

Leave a Reply