is invoked, it will create a new thread
with the tuple (5,'intersect')
as a parameter, which will be remembered
as the self.threadParameter attribute.
Now, in the run(self) method,
you can refer to self.threadParameter
and access those parameters for the particular
thread you created earlier. That way, you can
customize behavior for each thread.

How do I kill a python program running under Unix?

I usually try Control-C or Control-D to stop the program.
But I sometimes find (especially when the program is using
the threading module, that these keyboard interrupts aren't
effective. In those cases, I open another console window
and do the command

ps -u herman

which lists all the processes I am running (change "herman"
to your own userid, of course). Then under the column PID
(process id) I find one of them that is running the command
"python". That's the process I want to kill; suppose the
number is 16782. Then I execute the command
(still in the new window)

kill -9 16782

The "-9" is the highest priority form of kill (the others
are maybe set for stun only) and it does the job.

How do I find online help under Unix?

The help() function seems to work, but it is somewhat
clumsy. I found that you can directly access the html
online documents by opening the following URL in the
browser, at least on the departmental linux machines:

file:///usr/share/doc/python-docs-2.2.2/html/index.html

This is out of date (version 2.2.2 rather than 2.3), but
sufficient for most purposes.
But even if that doesn't work for you, the equivalent
documents are somewhere on
python.org.

The first sock.connect() call works OK, but the second
one has an error.

The sock object apparently cannot be so easily reused.
To fix this, put the line

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

just before the second sock.connect() call.
This line recreates a brand new, clean and never-used
socket object for you. Then the code will work just fine.

When I ran the http_get.py script it shows
in the header that the content length is 2690.
However when I read the file in and check the length I
only get 1430. Is the content type the whole file, or
is it just the HTML code? I'm off by 1200 bytes
according to the script.

Great question! The content length is the number of bytes
that follows all the headers (including, I think, the empty last
line). Browsers use this to know exactly how many bytes to
read without getting "stuck" in a recv() operation. This can be
crucial to correct browser operation, especially when a server
does not close a connection (ie, does not do sock.close() at the
end). Why wouldn't a server close a connection? If the browser
sends a "Connection: keep-alive" as part of the headers, that
is a hint to the server that it should not close the TCP connection
in case the browser will be sending another request very soon
-- such as a GET request for a .jpg or .gif image --
which saves having to do
extra connection setup overhead between the browser and
server.

What is the least amount of header information that
needs to be sent back to the browser?

In my experience, it can be as little as just the

HTTP/1.0 200 OK
Content-Type: text/html

I'm guessing this is enough, provided your server immediately
closes the connection after sending the web page. But if you
ever write a fancy server that can do the keep-alive trick, you
would also need to have the

Content-length: nnnn

keyword in the headers. And remember, don't forget that
empty line between the headers and the actual web page!