Interestingly enough, I've hit this same sort of problem in ruby. If the parser sees a local assignment the variable becomes local, even if the assignment never happens.
On Thu, Jan 12, 2012 at 1:38 PM, Mat Schaffer <[address removed]>
Just when you thought you were safe:
Looks like introducing a local assignment (even if it's never evaluated) throws a wrench in this whole mix (updated https://gist.github.com/1601533
Back to uglycode.py being the only one that works even if it does bark at me. I think I may try some trickery with exec and execfile to see what I can do there.