"snoe" <[EMAIL PROTECTED]> writes:
> Also why is it if I set tmp as a global and don't pass it as a
> paremeter to the various functions as per the OP that I get an
> "UnboundLocalError: local variable 'tmp' referenced before assignment"?

If you don't declare it as a global, and if you try to assign a value
to it, then Python thinks it's a local.  If you only refer to it and
never assign it, Python decides it's global.  Python is weird that
way.  One consequence is that if it's local to some outer scope, then
it's neither global nor local to your function, so there's no way to
assign to it.

I think Pythonic style is to not do complex things with closures,
but to use class instances instead.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to