osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python scope question


On 2019-03-12, Arup Rakshit <ar at zeit.io> wrote:

> I have questions how nonlocal and global affecting the variable
> assignment. Also how each print statement looking up the values for
> the spam variable. This scope thing in python is very confusing too
> me still. Can anyone help me to understand this code w.r.t to scope
> in Python?

https://www.ynonperek.com/2017/09/11/python-variable-scope-implicit-global-and-nonlocal/

-- 
Grant Edwards               grant.b.edwards        Yow! If I pull this SWITCH
                                  at               I'll be RITA HAYWORTH!!
                              gmail.com            Or a SCIENTOLOGIST!