Program name: Difference between revisions

Content added Content deleted
Line 1: Line 1:
{{draft task|Basic language learning}}
{{draft task|Basic language learning}}
It is useful to programmatically access a program's name, e.g. for determining whether the user ran "python hello.py", or "python hellocaller.py", a program importing the code from "hello.py".
The task is to programmatically obtain the name used to invokethe program. (For example determine whether the user ran "python hello.py", or "python hellocaller.py", a program importing the code from "hello.py".)


Sometimes a [[multiline shebang]] is necessary in order to provide the script name to a language's internal ARGV.
Sometimes a [[multiline shebang]] is necessary in order to provide the script name to a language's internal ARGV.
Line 565: Line 565:


{{omit from|ZX Spectrum Basic}}
{{omit from|ZX Spectrum Basic}}

[[Category:Initialization]]