[Tutor] command line
Erik Price
erikprice@mac.com
Sat, 30 Mar 2002 16:46:39 -0500
On Saturday, March 30, 2002, at 03:07 PM, dman wrote:
> You can also do
> python -i <filename>
> to drop into an interactive shell after executing the file. You'll
> have the same namespace as the file's module too.
Can I ask an unrelated question? What does that mean -- "you'll have
the same namespace as the file's module too".
I understand the difference between local/global/builtin namespaces (I
think): the local namespace is for names specific to the current context
(a function or class or module, for instance), the global namespace is
for names available to all contexts, and the builtin namespace is for
names that are predefined by Python and often start with two underscores.
I'm guessing that the quote above means that the names available to the
script are now available to the user in the shell, when the shell is
invoked in this fashion, such that if the script imported from module
"Stock", all of the names in "Stock" are available and don't need to be
imported. But if someone could confirm this it would help me grasp the
concept of namespaces better.
Thanks,
Erik