pure aesthetic question

Fernando Perez fperez528 at yahoo.com
Mon May 19 15:31:00 EDT 2003


Helmut Jarausch wrote:

> Alex Martelli wrote:
>> <posted & mailed>
>> 
>> Helmut Jarausch wrote:

> Many thanks,
> as far as I understand, it compiles the script each time
> it's invoked?

Yes.  Here's the typical approach (example taken from my own project, but most
people do something similar).  I just trimmed the docstring a bit for brevity
here:

### executable file named ipython, no .py extension:

#!/usr/bin/env python
"""IPython -- An enhanced Interactive Python

This is just the startup wrapper script, kept deliberately to a minimum.
"""

import IPython
IPython.Shell.IPShell().mainloop()

### /end ipython

The IPython.Shell module gets compiled into a .pyc file, and that's where all
the 'meat' goes.  Since the actual ipython script is only a docstring and two
lines of python code, whether it gets compiled every time or not doesn't make
the slightest difference to the user.


Cheers,

f.




More information about the Python-list mailing list