Python Language Variable Scope and Binding Binding Occurrence


Example

x = 5
x += 7
for x in iterable: pass    

Each of the above statements is a binding occurrence - x become bound to the object denoted by 5. If this statement appears inside a function, then x will be function-local by default. See the "Syntax" section for a list of binding statements.