[Tutor] Sun says: Don't use Java, use Python!
Paul Tremblay
phthenry@earthlink.net
Mon Feb 10 20:11:03 2003
On Mon, Feb 10, 2003 at 12:18:59PM -0800, Jeff Shannon wrote:
> Paul Tremblay wrote:
>
> >So doesn't this mean that if you are planning to distribute a Python
> >script (as I am), that you should distribute it as a module? I hadn't
> >even considered that modules are faster than scripts before reading this
> >thread.
> >
> >
>
> That depends on the script. Remember, the term 'module', when applied
> to Python files, is simply a statement that the file is used via
> 'import' in some other file, so distributing a script as a module
> implies that you have a script file that imports that module and runs
> some function(s) from it.
>
> If it's a short, quick script, then it's probably not going to make
> enough of a difference to worry about. The simplicity of distributing a
> single file would be more valuable than the speed gain that you'd get
> from having the bytecode precompiled. (Precompilation only affects
> startup speed, *not* actual running speed.)
The script will be over 3,000 lines long. In order to parse the RTF, it
has to make a dozen or so passes through the file. The reason for so
many passes is that RTF is very dense. I had written a successful perl
script that parsed RTF in one pass, but the script is almost unreadable.
The newer perl script (not the one above) makes a module for each pass
through the file. I thought this was bad design, because I had a dozen
or so modules.
But you are telling me that it is perhaps best to keep the script
modular?
>
> main.run()').
>
> Depending on your distribution requirements, it may or may not be worth
> the effort to set up a distutils script to install your package on new
> machines. If it's a pure Python package, then all distutils would be
> doing is copying it to a subdirectory of
> [Python-home]\Lib\site-packages, which is easy enough to do manually...
>
Setting up the distribution is not such an easy task. With the perl
script, I thought it would be a piece of cake, but I am really strugging
with writing the set-up script. For that reason, I wanted to make sure I
knew how to do this with Python *before* the script was finished, and
before I ralized that I should have done x, y or z--but realized it was
going to be really hard to do so at this point.
Paul
--
************************
*Paul Tremblay *
*phthenry@earthlink.net*
************************