is there a way to warn about missing modules *without* running python?

lkcl luke.leighton at gmail.com
Wed Jun 9 14:53:50 EDT 2010


On Jun 5, 2:16 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> Neither Python, nor Javascript (as far as I know -- I welcome
> corrections) do static linking.

 for the command-line versions of javascript such as spidermonkey, i
believe that a keyword/function is dropped into the global namespace -
"load", which take one argument (a filename).

 in browsers, it's much more waffly: anything that is tagged as
"script language='javascript'" gets executed in a global namespace
(into which two strategically critical global variables have been
dropped: "window" and "document", which is really the only "real" clue
that you have that this is javascript in a web browser engine, not
javascript at a command-line).

 so, if the DOM happens to ever get modified (typically using AJAX),
such that an additional node with a tag of "script" and an attribute
"language='javascript'" happens to get added, the browser engine
_happens_ to notice and _happens_ to execute the resultant newly-added
javascript.

 this well-known but horribly archaic technique is about as close to
dynamic module loading that you're ever likely to get in web browsers.

 everything else is "static", so to speak, and _everything_ operates
in one monster global namespace (on a per-page basis).

 ... but i digress :)

> Python modules are, conceptually speaking, like DLLs. They are loaded at
> runtime, not at compile time. This has many advantages over static
> linking, but some disadvantages as well.

 thank you, steve - i believe this is the crux of the matter (which
terry's analogy expanded on).  much appreciated the replies.

 l.




More information about the Python-list mailing list