Message254173
We try to have IDLE work the same as Python (and CPython, where relevant), except where differences are intentional or unavoidable. I am trying to eliminate some unintentional avoidable differences in other issues. However, this one is unavoidable given IDLE's basic design. Also, Steven is correct; see
https://docs.python.org/3/library/builtins.html#module-builtins
IDLE executes user code with "exec(code, self.locals)" (run.py, l.351 in 3.5).
https://docs.python.org/3/library/functions.html#exec
says "If the globals dictionary does not contain a value for the key __builtins__, a reference to the dictionary of the built-in module builtins is inserted under that key."
(Doc issus: From the builtins doc and the Jython example, this seems implementation dependent. Steven, does
>>> d = {}; exec('', d); d.keys()
dict_keys(['__builtins__'])
have this result in Jython?)
In the IDLE shell, each statement is exec'ed separately. With two statements, __builtins__ is added back before 'min' , while with one statement, it is not.
Editor: Run Module execs the entire file at once. I expected print(min) to fail either way, but it works either way. I verified that globals().keys() lost '__builtins__', so I don't know how __builtins__.min is found.
I left this open to consider adding a line to
https://docs.python.org/3/library/idle.html#idle-console-differences |
|
Date |
User |
Action |
Args |
2015-11-06 08:37:07 | terry.reedy | set | recipients:
+ terry.reedy, steven.daprano, ppperry |
2015-11-06 08:37:07 | terry.reedy | set | messageid: <1446799027.47.0.164262255164.issue25564@psf.upfronthosting.co.za> |
2015-11-06 08:37:07 | terry.reedy | link | issue25564 messages |
2015-11-06 08:37:06 | terry.reedy | create | |
|