A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/080905.html below:

Boolean Values

Boolean ValuesFredrik Lundh fredrik at pythonware.com
Fri Apr 6 03:28:49 EDT 2001
D-Man wrote:
> So what is the difference between __builtin__ and __builtins__?

__builtin__ is a module, __builtins__ is a module-level
attribute that usually (but not always) points to that
module.

in CPython, if you ask for a global name that doesn't
exist, Python looks for a __builtins__ module variable.
if it is present, Python looks for the global name in
there.

if __builtins__ doesn't exist, CPython does an "import
__builtin__ as __builtins__", and looks again.

this is a performance optimization, but more importantly,
it allows you to use your own __builtins__ dictionary when
executing foreign code.

> Why does CPython make __builtins__ visible by default and
> Jython doesn't?  Since messing with __builtins__ like this isn't
> really a good idea, it seems that Jython is better for not
> makeing __builtins__ so readily accessible.

since this behaviour is documented in the language reference,
this looks like a bug in jython...

Cheers /F



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4