Sujet : Re: Variable scope inside and outside functions
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 06. Mar 2024, 00:12:24
Autres entêtes
Organisation : Stefan Ram
Message-ID : <define-20240306000929@ram.dialup.fu-berlin.de>
References : 1
Grant Edwards <
grant.b.edwards@gmail.com> wrote or quoted:
Python Global variables are those which are not defined inside
any function and have a global scope whereas Python local
variables are those which are defined inside a function and their
scope is limited to that function only.
Since "define" (in this context) isn't a term of art in Python, and
|If a local variable is defined in a block,
The Python Language Reference, Release 3.13.0a0,
4.2.2 Resolution of names, p1
|checking the module’s namespace for a variable named __all__;
|if defined, it must be a sequence of strings
ibid., 7.11
|class variable A variable defined in a class
ibid., Appendix A