Say I have a (somewhat pointless) Python script
#!/usr/bin/python
a = 5
Is there a way to run this script from the interactive prompt such that after running if I type a I get
>>> a
5
and not
>>> a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
More generally, if my script calculates something through a series of steps, is there a way to access that something after the script has finished (in the same kind of manner).
from pointless import *(or, very rarely,execfile); for the second, it'spython -i pointless.py.