Daniel Debrunner <[email protected]> added the comment:
Another case:
model="Hello"
class M(object):
def __init__(self):
pass
def __call__(self):
print(self.model)
cvs = inspect.getclosurevars(M.__call__)
ClosureVars(nonlocals={}, globals={'model': 'Hello'}, builtins={'print':
<built-in function print>}, unbound=set())
Of course self.model does not refer to the global model
M()()
AttributeError: 'M' object has no attribute 'model'
----------
nosy: +Daniel Debrunner
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com