PEP suggestion: Uniform way to indicate Python language version

Rustom Mody rustompmody at gmail.com
Mon Aug 22 06:44:30 EDT 2016


On Monday, August 22, 2016 at 3:53:27 PM UTC+5:30, rocky wrote:
> On Monday, August 22, 2016 at 2:04:39 AM UTC-4, Random832 wrote:
> > On Mon, Aug 22, 2016, at 01:35, Steven D'Aprano wrote:
> > > Could somebody (the OP?) please explain what is the purpose of this
> > > proposal, what it does, how it works, and when would people use it?
> > 
> > I think what he wants is a way for a module which uses features
> > (syntactic or otherwise, but I suppose especially syntactic features
> > since this can't as easily be done with a runtime check using existing
> > mechanisms) from a particular python version and which makes no
> > provision to run under earlier versions to fail with a message like
> > "This script requires Python 3.4 or later" rather than a mysterious
> > syntax error or worse a runtime error after the program has been running
> > for some time.
> 
> Right. People are focusing on specific code instead of the problem: a simple and uniform way to indicate a specific Python dialect in force for that program. The language continues to evolve over time: there are many Python 2.7 programs that won't work on Python 2.5 or earlier and vice versa. When you expand the range from Python 1.5 to Python 3.6 the likelihood of the program running becomes even smaller.
> 
> Furthermore, I am not aware of any program that when given a Python source code will tell you which or versions or dialects of Python it will run on. 
> 
> The fact that there has been all this much discussion over specific code to me enforces the need for a simple an uniform mechanism.

Prior Art:
I may mention that the web-language curl has this feature builtin
See very first example here:
https://en.wikipedia.org/wiki/Curl_(programming_language)

Note this is version(s) specification
Auto version detection is hard and likely impossible



More information about the Python-list mailing list