Shebang or Hashbang for modules or not?

Paddy paddy3118 at googlemail.com
Wed Apr 11 12:48:17 EDT 2007


On Apr 11, 5:29 pm, "Chris Lasher" <chris.las... at gmail.com> wrote:
> Should a Python module not intended to be executed have shebang/
> hashbang (e.g., "#!/usr/bin/env python") or not? I'm used to having a
> shebang in every .py file but I recently heard someone argue that
> shebangs were only appropriate for Python code intended to be
> executable (i.e., run from the command line).

If you don't intend the module to be executable then adding a shebang
line and/or setting the files execute bit are both contrary to
intended use. You should therefore leave out the shebang/not set the
execute bit to emphasise your intended use.
During development however, intended use may differ from use when
deployed.

- Paddy.




More information about the Python-list mailing list