Julien Palard added the comment:

Hi Xavier,

> It is not the dictionary of builtin module, which is inserted in , but the 
> current __builtin__ global 

It looks wrong, I'll even say the exact contrary: It _is_ the dictionary of 
builtin module which is inserted in, not the current __builtin__ global, with 
this proof:

$ ./python
Python 3.7.0a0 (default, Nov 29 2016, 11:20:17) 
[GCC 5.4.1 20161019] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print(id(__builtins__), id(__builtins__.__dict__))
140325888797784 140325888840368
>>> eval("""print(id(__builtins__))""", {})
140325888840368


> the current __builtin__ global which happen to be normally the dictionnary of 
> builtin.

That's not necessarily true, according to [the builtins 
doc](https://docs.python.org/dev/library/builtins.html):

> The value of __builtins__ is normally either this module or the value of this 
> module’s __dict__ attribute.

Typically:
$ ./python
Python 3.7.0a0 (default, Nov 29 2016, 11:20:17) 
[GCC 5.4.1 20161019] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import builtins
>>> id(builtins), id(builtins.__dict__), id(__builtins__)
(139706743340120, 139706743382704, 139706743340120)

Here, __builtins__ is the module, not its dict.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to