The assertion should have been assert sys.version >= (3, 0)
If we want to indicate the Python program supports language versions 3.0 and greater. On Sunday, August 21, 2016 at 3:59:48 PM UTC-4, Vincent Vande Vyvre wrote: > Le 21/08/2016 à 20:28, rocky a écrit : > > The problem: > > > > 1. there are various code inspection tools that parse Python programs > > looking for style issues or whatnot. The deeper ones have to do a full > > parse of the python program. It would be helpful if there were a uniform > > way to indicate the Python language level used in Python source code. > > > > 2. I get a standalone python program that is not part of a package. > > vcprompt https://bitbucket.org/gward/vcprompt might be an example > > It would be helpful if there were an easy way to know what language version > > of Python it assumes > > > > Perl has something like called "use perl". "use" is roughly equivalent to > > "import". > > > > Possible solutions: > > > > Do it the similar to "use perl". Here "perl" is a package that just tests > > the parameter given it. In Python such the code would look something like > > > > File/module python30.py > > > > import sys > > assert sys.version >= (sys.version_info >= (3, 0)) > > > > The above works, but to reduce proliferation of packages it might be > > preferable to come up with some way to pass a version specification string > > similar to the specification strings allowed in setup.py > > > > A metadata tag as a comment in a docstring or in a comment. > > Preferably this would be given towards the top of the file to make it > > easier for tools to extract this information. > > > > Thoughts? > > I don't understand your assertion > > Python 3.2.3 (default, Jun 18 2015, 21:46:42) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> assert sys.version >= (sys.version_info >= (3, 0)) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: unorderable types: str() >= bool() > > > What you means ? > > -- > Vincent V.V. > Oqapy <http://www.oqapy.eu> . python3-exiv2 > <http://www.py3exiv2.tuxfamily.org/> . Qarte > <https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager> -- https://mail.python.org/mailman/listinfo/python-list