globals()

Returns a dictionary of the global symbol table defined in a module.

Parameters

  • globals() does not take any parameters.

Return Value

  • globals() returns a dictionary of the current global symbol table.

Examples

print(globals())

{
    '__name__': '__main__', 
    '__doc__': None, 
    '__package__': None,  
    '__spec__': None, 
    '__annotations__': {}, 
    '__builtins__': , 
    [...]
}

If called inside a function, it returns the dictionary of the module where the function is defined, not the module from which it was called.