On Fri, Dec 5, 2014 at 10:54 AM, Dave Angel <da...@davea.name> wrote:
> Python doesn't have declarations, so when a function is compiled, the
> compiler has to infer what names are to be local and what are not.  The rule
> it normally uses is roughly based on whether an assignment occurs somewhere
> inside the function.

Not strictly true; Python just inverts the C model. In C, you declare
your locals; in Python, you declare your globals. The "global x"
statement is a declaration. But otherwise, yes. When a function is
compiled, the compiler has to figure out what's local and what's
global.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to