PEP suggestion: Uniform way to indicate Python language version

rocky rocky at gnu.org
Mon Aug 22 07:48:43 EDT 2016


On Monday, August 22, 2016 at 12:33:53 AM UTC-4, Chris Angelico wrote:
> On Mon, Aug 22, 2016 at 1:37 PM, rocky <rocky at gnu.org> wrote:
> > Sorry should have been:
> >
> >  assert sys.version_info >= (3,0)
> 
> The next question is: How common is code like this? I don't put
> version checks in any of my modules. Adding magic comments would be of
> value only if this sort of thing is common enough to need its own
> syntax.
> 
> ChrisA

I'll answer your question with a question: How common are "software as service" code-analysis tools for Python used? 

A slightly different but related problem is noting the Python dialect at the package-level. If a package is in Pypi then PKGINFO can contain the a list of Python dialects supported. If the program is not in Pypi, then what? As with "use perl" inside source code, the same mechanism ("use perl") is used inside its build system(s) to indicate which dialects a Perl package supports.



More information about the Python-list mailing list