On Mon, Apr 28, 2014 at 7:51 AM, Andrew Konstantaras <akon...@icloud.com> wrote: > I will give the locals approach a try, it seems a little more clumsy than > simply passing the variables to the function.
This is your fundamental misunderstanding that's led to all of this. You do not "pass variables to a function"; you pass objects. As far as Python's concerned, there's no difference between these functions: def foo(): a = 42 return f(a) def bar(): b = 42 return f(b) def quux(): return f(42) Each one passes the integer 42 to f(). The fact that it's referenced by different names is utterly meaningless. It's the object 42, not the name a or b, that gets passed in to the function. At best, your makeDict will be fragile. It can be broken by all sorts of unrelated changes. At worst, it's horribly misleading to other programmers. ChrisA -- https://mail.python.org/mailman/listinfo/python-list