Note that source compatible scripts may continue to refer to the version agnostic python command without affecting portability

This commit is contained in:
Nick Coghlan 2011-03-05 07:06:50 +00:00
parent 46fb064332
commit 4a7ccd55db
1 changed files with 3 additions and 0 deletions

View File

@ -48,6 +48,9 @@ Recommendation
This distinction should be made in shebangs, when invoking from a shell
script, when invoking via the system() call, or when invoking in any other
context.
* One exception to this is scripts that are deliberately written to be source
compatible with both Python 2.x and 3.x. Such scripts may continue to use
``python`` on their shebang line without affecting their portability.
* When reinvoking the interpreter from a Python script, querying
``sys.executable`` to avoid hardcoded assumptions regarding the
interpreter location remains the preferred approach.