Author eric.smith
Recipients Noitul, eric.smith, nitishch, yselivanov
Date 2019-04-23.10:10:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556014233.51.0.159958136165.issue36697@roundup.psfhosted.org>
In-reply-to
Content
That is interesting. See these examples. I'm starting a new interpreter each time:

>>> import inspect
>>> def abc(): pass
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={}, builtins={}, unbound=set())
>>>


>>> import inspect
>>> def abc(): a
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={}, builtins={}, unbound={'a'})
>>>

>>> import inspect
>>> a=0
>>> def abc(): a
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={'a': 0}, builtins={}, unbound=set())
>>>

>>> import inspect
>>> a=0
>>> def abc(): a.b
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={'a': 0}, builtins={}, unbound={'b'})
>>>

>>> import inspect
>>> a=0
>>> b=1
>>> def abc(): a.b
...
>>> inspect.getclosurevars(abc)
ClosureVars(nonlocals={}, globals={'a': 0, 'b': 1}, builtins={}, unbound=set())
>>> 

It's odd.
History
Date User Action Args
2019-04-23 10:10:33eric.smithsetrecipients: + eric.smith, yselivanov, nitishch, Noitul
2019-04-23 10:10:33eric.smithsetmessageid: <1556014233.51.0.159958136165.issue36697@roundup.psfhosted.org>
2019-04-23 10:10:33eric.smithlinkissue36697 messages
2019-04-23 10:10:33eric.smithcreate