This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients eryksun, paul.moore, ricpol, steve.dower, tim.golden, wdhwg001, zach.ware
Date 2017-02-06.22:23:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486419820.69.0.827773931079.issue28686@psf.upfronthosting.co.za>
In-reply-to
Content
> 2) you really want to have meaningful shebangs (ie, version-specific) in your scripts because, well, 2017 and the world is still split between py2 and py3, 

This is the one I think is overspecifying. I don't see a really *good* reason for not just saying /usr/bin/env python.

What would you want to happen if you said /usr/bin/env python3 if you had Python 2 on your PATH? The only reasonable answer I can see is "give an error", so why not just put

    if sys.version_info < (3,0):
        raise RuntimeError("Needs python 3")

at the top of your script?

Add to this the fact that I don't even know how you'd check if a python interpreter that's on PATH is Python 2 or 3 without executing it (and the overhead of running it an extra time to query its version is unacceptable) and I still don't see the justification.

> - just look at my %path% before doing anything else. It could be that the first interpreter you find there will just match the requirement from the shebang (that is, because on occasion I just know what I'm doing, and I've just activated a matching venv, you see). If so, just give me that Python and I will be ok; 
> - otherwise, my bad: feel free to resume any other search strategy you find appropriate, and I will humbly accept whatever interpreter you may fetch, even a php one. 

> I think this would be just reasonable enough. What I'm missing here?

You're missing the fact that it's not possible to tell by inspection the version of a Python interpreter. On Unix, the executable name includes the version, so it's easy. If Python on Windows changed to ship python3.exe and python37.exe alongside python.exe, then it might be worth revisiting this discussion, but not as things stand (IMO).
History
Date User Action Args
2017-02-06 22:23:40paul.mooresetrecipients: + paul.moore, tim.golden, zach.ware, eryksun, steve.dower, wdhwg001, ricpol
2017-02-06 22:23:40paul.mooresetmessageid: <1486419820.69.0.827773931079.issue28686@psf.upfronthosting.co.za>
2017-02-06 22:23:40paul.moorelinkissue28686 messages
2017-02-06 22:23:40paul.moorecreate