I learnt that memory model of python interpreter is dictionaries of dictionaries, where each module is a dictionary. Let me elaborate more on this with an example,
After i run
>>> python hog.py
(say), all name
-value
bindings written in hog.py
file are part of __main__
module. name
is part of current module will point to value
(everything is an object) sitting in heap.
Every module has global frame
and local frame`.
In hog.py
file, When i say,
from dice import four_sided_dice, six_sided_dice, make_test_dice
from ucb import main, trace, log_current_line, interact
These aforementioned functions will execute in the scope of module ucb
or dice
module respectively but not in the scope of __main__
module.
In above syntax, imports with names are like pointers to functions in the module outside __main__
module. This can be verified using the value of global variable __name__
.
=======================
Javascript engine sits in the browser.
How does memory model of Java script engine work?