Shebang or Hashbang for modules or not?

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Fri Apr 13 07:29:48 EDT 2007


On 13 Apr 2007 10:54:18 GMT, Jorgen Grahn <grahn+nntp at snipabacken.dyndns.org> wrote:
> On Thu, 12 Apr 2007 00:24:12 +0200, Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> wrote:
>> Chris Lasher a écrit :
>>> Should a Python module not intended to be executed have shebang/
>>> hashbang (e.g., "#!/usr/bin/env python") or not?
>>
>> The shebang is only useful for files that you want to make directly 
>> executable on a *n*x system. They are useless on Windows,
>
> Probably (unless setup.py uses them for something meaningful there,
> too).

There's another, secondary, reason to use a shebang on Python source
which isn't executable: the Unix file(1) command and friends can see
that it's Python code.

(Of course, such files will almost always be named foo.py.)

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list