Hello There,

We all know that line starting with "#" in Python is a comment.

We also know that when the first line of any file (with any extension)
has "#!/usr/bin/env bash" and if you make it executable and do
./filename.ext in the terminal then it will be considered as bash file
(in this case even if the extension is.py the terminal will take it as
bash file.)

This same thing also happens with Python (If the first line of the
file has #!/usr/bin/env python then even if the extension is .txt, if
you make it an executable then terminal will process it with python
interpreter.)

So far we know two things:
1. "#" makes the line a comment in Python.
2. If processing file with bash, no matter what the file extension is,
if the first line of that file hsa "#!/usr/bin/env python" and it is
an executable and you run it doing like ./filename.ext, the bash will
call python interpreter to process that file.

Now let's get back. I'm reading a book "A Byte of Python"
(http://www.swaroopch.org/notes/Python). In this page:
http://www.swaroopch.org/notes/Python_en:First_Steps, under the
section Using a Source File. There is a line saying that "A word of
caution on the shebang..". On the next line the book says we can use
#!C:\Python32\python.exe to make it executable.

My Question:
Is it true that doing that is as same as doing #!/usr/bin/env python
on Unix? Because I think that the matter of shebang is limited to Bash
and Windows don't have a bash, it has a Command Prompt. And I don't
think such thing happens in Windows.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to