On Monday, August 22, 2016 at 6:44:43 AM UTC-4, Rustom Mody wrote: > 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
As mentioned in the original post Perl has it too. http://perldoc.perl.org/functions/use.html And I gotta say it is pretty clever how they worked in the duplicate match up between common English usage and valid programming language syntax. -- https://mail.python.org/mailman/listinfo/python-list