PEP suggestion: Uniform way to indicate Python language version

Chris Angelico rosuav at gmail.com
Mon Aug 22 08:44:49 EDT 2016


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



More information about the Python-list mailing list