"Chris Lasher" <[EMAIL PROTECTED]> writes: > I recently heard someone argue that shebangs were only appropriate > for Python code intended to be executable (i.e., run from the > command line).
Since that's the purpose of putting in a shebang line, that's what I'd argue also; specifically: - Modules intended primarily for import should be named 'foo.py' and have no shebang line. This doesn't preclude having an 'if __name__ == "__main__":' block, and running the module as 'python ./foo.py' for whatever reason. - Modules intended primarily for running as a command should have a shebang line and an 'if __name__ == "__main__":' block, and be named according to the conventions of the OS for naming command programs; on *nix, this means naming the file 'foo'. This doesn't preclude importing the module (e.g. for unit testing), though it is a little more convoluted than a simple 'import' statement. -- \ "Dad always thought laughter was the best medicine, which I | `\ guess is why several of us died of tuberculosis." -- Jack | _o__) Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list