name 'aLOCK' is not defined When I add aLOCK = threading.RLock() behind if __name__ == "__main__"

Karsten Hilbert Karsten.Hilbert at gmx.net
Fri Aug 10 02:15:09 EDT 2018


On Fri, Aug 10, 2018 at 12:24:25AM +0800, xuanwu348 wrote:

> Yes, move the code from positionA(can run normally) to positionB(exception with name undefined)
> I find this content "https://docs.python.org/3.3/tutorial/classes.html#python-scopes-and-namespaces"
> But I still don't undewrstand the differenct of  scopes-and-namespaces between positionA and positionB,
>
> I think the variable "aLock" at these positionA or  positionB are all global.

When something goes wrong in an unexpected way: test
your assumptions ;-)

Best,
Karsten
-- 
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



More information about the Python-list mailing list