t550.py 312 B

123456789101112131415161718192021
  1. def foo():
  2. pass
  3. bar = 11
  4. print globals()['bar']
  5. print 'foo' in globals()
  6. def baz(x):
  7. print 'baz' in globals()
  8. baz(10)
  9. class MyClass:
  10. def __init__(self):
  11. print globals()['__name__']
  12. print 'MyClass' in globals()
  13. print type(globals()['baz'])
  14. y = MyClass()