Why is module math called "built-in"?
Question: AFAIK, Python `builtins` refers to those exceptions and functions contained in
`__builtins__`:

    
    
    >>> import builtins  # import __builtin__ in Python 2
    >>> dir(builtins)  # dir(__builtin__) for Python 2
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',
    'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',
    ...many more...
    'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'reversed',
    'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum',
    'super', 'tuple', 'type', 'vars', 'zip']
    

But look at the code below (both Python2 and 3 gave the same results):

    
    
    >>> globals()
    {'__name__': '__main__', '__builtins__': <module 'builtins' (built-in)>,
     '__loader__': <class '_frozen_importlib.BuiltinImporter'>,
     '__doc__': None, '__package__': None}
    >>> import threading
    >>> import math
    >>> globals()
    {'__name__': '__main__', '__builtins__': <module 'builtins' (built-in)>,
     '__loader__': <class '_frozen_importlib.BuiltinImporter'>, 
     '__doc__': None, '__package__': None,
     'threading': <module 'threading' from C:\\ProgramFiles\\Python3.3\\lib\\threading.py'>,
     'math': <module 'math' (built-in)>}
    

On the last line, module `math` is called `built-in`. Why? What's the
difference between module `math` and other modules like `threading`?


Answer: In your case the `math` module was included into the main Python library
itself (`libpython2.7.{so,dll,dylib}`) when the library was built. This is
possible since the module is written in C rather than pure Python. Other
modules that are like this include `sys` and `posix`.

