28.3.__builtin__ — Built-in objects

This module provides direct access to all ‘built-in’ identifiers of Python; forexample,__builtin__.open is the full name for the built-in functionopen(). SeeBuilt-in Functions andBuilt-in Constants fordocumentation.

This module is not normally accessed explicitly by most applications, but can beuseful in modules that provide objects with the same name as a built-in value,but in which the built-in of that name is also needed. For example, in a modulethat wants to implement anopen() function that wraps the built-inopen(), this module can be used directly:

import__builtin__defopen(path):f=__builtin__.open(path,'r')returnUpperCaser(f)classUpperCaser:'''Wrapper around a file that converts output to upper-case.'''def__init__(self,f):self._f=fdefread(self,count=-1):returnself._f.read(count).upper()# ...

CPython implementation detail: Most modules have the name__builtins__ (note the's') made availableas part of their globals. The value of__builtins__ is normally eitherthis module or the value of this modules’s__dict__ attribute. Sincethis is an implementation detail, it may not be used by alternateimplementations of Python.