[Python-ideas] Keyword to disambiguate python version

Nick Coghlan ncoghlan at gmail.com
Thu Aug 26 23:43:08 CEST 2010

On Fri, Aug 27, 2010 at 5:56 AM, Tony Lownds <tony at pagedna.com> wrote:
> Here is a different take on mechanism and semantics.
> First, I'd like to be able to use:
> #!/usr/bin/python3
> This allows a simple rough cut is a packaging issue, but IIRC the standard
> Makefile does not create python3. So the specific proposal is for the
> Makefile start doing that.  This thread might be worth reading re: this issue.
> http://www.mail-archive.com/fedora-devel-list@redhat.com/msg08865.html

The Python 3 bininstall target in the Makefile puts the binary under
the python3 name:
    (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)3$(EXE))

(Note the "3" between $(PYTHON) and $(EXE))

So if people want to flag a script specifically as python3, they can
already say that in the shebang line either by referencing it directly
or by writing "#!/usr/bin/env python3").

This was done so that a "make install" of Py3k on a Linux box wouldn't
inadvertently clobber the system Python installation (I believe David
Malcolm from Fedora was one of a number of people making that

For anything else, I've never been a fan of "last version tested"
markers embedded in the code. It usually just leads to unnecessary
noise and busy-work (cf. Blizzard's "load out of date addons" flag to
workaround their own version markers for World of Warcraft addons).


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list