En Sun, 31 Jan 2010 18:17:04 -0300, _wolf <wolfgang.l...@gmail.com> escribió:

dear pythoneers,

i would be very gladly accept any commentaries about what this
sentence, gleaned from http://celabs.com/python-3.1/reference/executionmodel.html,
is meant to mean, or why gods have decided this is the way to go. i
anticipate this guy named Kay Schluehr will have a say on that, or
maybe even the BDFL will care to pronounce ``__builtins__`` the
correct way to his fallovers, followers, and fellownerds::

  The built-in namespace associated with the execution of
  a code block is actually found by looking up the name
  __builtins__ in its global namespace; this should be a
  dictionary or a module (in the latter case the module’s
  dictionary is used). By default, when in the __main__
  module, __builtins__ is the built-in module builtins;
  when in any other module, __builtins__ is an alias for
  the dictionary of the builtins module itself.
  __builtins__ can be set to a user-created dictionary to
  create a weak form of restricted execution.

Short answer: use `import builtins` (spelled __builtin__, no 's' and double underscores, in Python 2.x) to access the module containing the predefined (built-in) objects.

Everything else is an implementation detail.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to