Author steven.daprano
Recipients kolia, steven.daprano
Date 2019-07-11.21:15:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
To clarify further, unlike (say) Lua, Python doesn't allow variables to change scope part-way through a function. (At least not without hacking the byte-code.) In any function, a name refers to precisely one of (1) a local, (2) a nonlocal, and (3) a global, so you cannot have something like this:

a = 1
def func():
    print(a)  # refers to global a
    a = a + 1  # make a new local 'a'
Date User Action Args
2019-07-11 21:15:04steven.dapranosetrecipients: + steven.daprano, kolia
2019-07-11 21:15:04steven.dapranosetmessageid: <>
2019-07-11 21:15:04steven.dapranolinkissue37568 messages
2019-07-11 21:15:04steven.dapranocreate