PEP suggestion: Uniform way to indicate Python language version

rocky rocky at gnu.org
Mon Aug 22 08:52:31 EDT 2016


On Monday, August 22, 2016 at 8:45:05 AM UTC-4, Chris Angelico wrote:
> On Mon, Aug 22, 2016 at 10:05 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> > rocky <rocky at gnu.org>:
> >
> >> A slightly different but related problem is noting the Python dialect
> >> at the package-level.
> >
> > I don't know what if anything is needed support this idea, but one
> > option would be to just use "import":
> >
> >     import python3_5_17
> >
> > That would require Python and modules to install such empty modules to
> > indicate that they support the given API.
> 
> Preferable:
> 
> from python import v35
> 
> Then a single 'python.py' could have lines for every supported
> version, rather than forcing dozens of separate modules.
> 
> However, I don't think it's particularly necessary. Explicit version
> number checks should be very rare, and shouldn't be encouraged.
> Instead, encourage feature checks, as Steve gave some examples of.
> 
> ChrisA

Yes, "from python import v35" is better.

How do feature checks in the code address the problem static analysis of source code? 



More information about the Python-list mailing list