Novel Thoughts on Scripting and Languages

Andrew Dalke adalke at
Wed Jan 8 21:36:51 CET 2003

James Huang wrote:
> This is an example of scripting:
>   sendMail
>      from:  'me at'
>        to:  'a at, b at'
>        cc:  'd at'
>   subject:  'test test'
>    attach:  'bin.jar'
>      body:  [[*
>                 blah blah blah
>                 blah blah
>             *]]
>  htmlBody:  [[*
>                 <html><body><b>Blah</b> blah
>                 </body></html>
>             *]]
>  ;

As compared to programming which would let you specify the MIME
type for the attachment, or compose the content dynamically instead
of from a file, and say that the htmlBody is multipart/mixed instead
of multipart/alternative, or include PDF as one of the possible

Here's an example of something I don't see 'nicely' doable with
your API.  I want to send email to my clients.  For each client I
want to include a little graph (say a bandwidth usage graph) which
is automatically generated from my database.  In Python I can do
all this without having to explicitly use a temporary file.  It
seems that you have to create a temp file, which then means you
need to worry that the current directory is writeable or that there
isn't some sort of attack possible in your common-writeable
temporary directory.  (Hence not as 'nice'.)

I also wonder if there are problems sending headers which use
multiple character sets.  You only allow one character set for all
of the header.  Suppose my name is Peréz (in the From line) but
I want to send a Subject in Japanese?  Now, I don't know enough
about character sets to know if this is a problem (perhaps Hebrew
and Japanese might be a problem?) or even if email programs allow
this.  But I do know the email spec for encoding in the header
does allow intermixing multiple character sets in even the same
header line -- and Python's API supports it.

Anyway, if these limitations are part of scripting then I
prefer programming, where I can easily define a new function for
the special (though common!) case you have above.

There is an argument for making a programming language which is
easy to use so that non-programmers can work with it -- the
"Computer Programming For Everyone" idea.  That must be balanced
by the fact that while the common case is common, the special
cases are needed, even for beginners.

					dalke at

More information about the Python-list mailing list