Answer questions by MAL; add drawing by Ping.
This commit is contained in:
parent
d313d180ae
commit
0c994bd700
40
pep-0280.txt
40
pep-0280.txt
|
@ -394,6 +394,46 @@ Additional Ideas
|
||||||
self.reflect_bltin_new(key, newvalue)
|
self.reflect_bltin_new(key, newvalue)
|
||||||
|
|
||||||
|
|
||||||
|
FAQs
|
||||||
|
|
||||||
|
Q. Will it still be possible to:
|
||||||
|
a) install new builtins in the __builtin__ namespace and have
|
||||||
|
them available in all already loaded modules right away ?
|
||||||
|
b) override builtins (e.g. open()) with my own copies
|
||||||
|
(e.g. to increase security) in a way that makes these new
|
||||||
|
copies override the previous ones in all modules ?
|
||||||
|
|
||||||
|
A. Yes, this is the whole point of this design. In the original
|
||||||
|
approach, when LOAD_GLOBAL_CELL finds a NULL in the second
|
||||||
|
cell, it should go back to see if the __builtins__ dict has
|
||||||
|
been modified (the pseudo code doesn't have this yet). Tim's
|
||||||
|
alternative also takes care of this.
|
||||||
|
|
||||||
|
Q. How does the new scheme get along with the restricted execution
|
||||||
|
model?
|
||||||
|
|
||||||
|
A. It is intended to support that fully.
|
||||||
|
|
||||||
|
|
||||||
|
Graphics
|
||||||
|
|
||||||
|
Ka-Ping Yee supplied a drawing of the state of things after
|
||||||
|
"import spam", where spam.py contains:
|
||||||
|
|
||||||
|
import eggs
|
||||||
|
|
||||||
|
i = -2
|
||||||
|
max = 3
|
||||||
|
|
||||||
|
def foo(n):
|
||||||
|
y = abs(i) + max
|
||||||
|
return eggs.ham(y + n)
|
||||||
|
|
||||||
|
The drawing is at http://web.lfw.org/repo/cells.gif; a larger
|
||||||
|
version is at http://lfw.org/repo/cells-big.gif; the source is at
|
||||||
|
http://lfw.org/repo/cells.ai.
|
||||||
|
|
||||||
|
|
||||||
Comparison
|
Comparison
|
||||||
|
|
||||||
XXX Here, a comparison of the three approaches could be added.
|
XXX Here, a comparison of the three approaches could be added.
|
||||||
|
|
Loading…
Reference in New Issue