8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d685325 commit 268ec1eCopy full SHA for 268ec1e
tests/basics/fun_globals.py
@@ -19,3 +19,18 @@ def foo():
19
foo.__globals__ = None
20
except AttributeError:
21
print("AttributeError")
22
+
23
+# test closures have the __globals__ attribute
24
25
26
+def outer():
27
+ x = 1
28
29
+ def inner():
30
+ return x
31
32
+ return inner
33
34
35
+print(outer.__globals__ is globals())
36
+print(outer().__globals__ is globals())
tests/basics/fun_name.py
@@ -24,9 +24,11 @@ def Fun(self):
pass
# name of a function that has closed over variables
+# and also the name of the inner closure
def outer():
x = 1
def inner():
return x
return inner
print(outer.__name__)
+print(outer().__name__)
0 commit comments