[docs] What are the rules for local and global variables in Python?

Will Clark will8clark at gmail.com
Wed Nov 21 05:33:38 EST 2018


I am a new programmer so feel I have a great propensity to be wrong here, but I wonder if the phrasing here is correct, emphasis mine:

https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python



“”"
What are the rules for local and global variables in Python?

In Python, variables that are only referenced __inside__ a function are implicitly global. If a variable is assigned a value anywhere within the function’s body, it’s assumed to be a local unless explicitly declared as global. ...
“””



The text reads that variables which are _only_ referenced *inside* a function will be global, surely this should be *outside*, which I think would also make the following sentence make more sense.






Cheers,
Will





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20181121/14d050f8/attachment.html>


More information about the docs mailing list