A common Python idiom is to have a file like so:

  class Foo:
      ...

  ...

  def main ():
      ...

  if __name__ == "__main__": main ()

What this does is allows me to import the file as a module and get
access to Foo and such, but if the file is run directly (through
python blah.py or however), to run the main function.  This has come
up in the context of web programming; I'd like to have a Servlet class
that I can subclass and do nice things with, but still be able to run
the script through CGI or mod_ruby.

Is there an idiomatic way to do this?
-- 
Graham Hughes <graham / ccs.ucsb.edu>
(defun whee (n e) (subseq (let ((c (cons e e))) (nconc c c)) 0 n))