#!/usr/local/cpython-3.6/bin/python3 """Test whether locals() is a copy of the local namespace, or a reference.""" import sys def main(): """Run the test.""" var = 1 locs = locals() locs['var'] = 2 if var == 2: sys.stdout.write('locals not just a copy\n') else: sys.stdout.write('locals is just a copy\n') main()