3 examples of 'python globals()' in Python

Every line of 'python globals()' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
18def test_globals(self):
19 self.assert_ok("""\
20 global xyz
21 xyz=2106
22
23 def abc():
24 global xyz
25 xyz+=1
26 print("Midst:",xyz)
27
28
29 print "Pre:",xyz
30 abc()
31 print "Post:",xyz
32 """)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

275def _locals():
276 '''(INTERNAL) For C{pycocoa.__main__.py} only'
277 '''
278 return globals()
62def globals(self):
63 code = self.get_bytecode()
64 return code.globals()

Related snippets