0

My question is if there is a difference between a python module compiled in python3.7 to the same module compiled in other Python3 sub-version?

I work in an environment in which I don't have pip to install modules so I have to compile the modules myself. I wonder if today I'm compiling a module with Python3.7, will it work tomorrow when I'll upgrade to Python3.8 or downgrade to Python3.6

Thanks is advance

Amir
  • 3
  • 1
  • For developments it's the best to use virtual environment with interpreter that is the same version as in target environment. Newer versions of Python might introduce syntax that is not present in older versions. The other way around should work (older compiled stuff theoretically shouldn't break on newer versions), as long as you stay within python 3.x (2.x is not compatible with python 3). – h4z3 Jul 08 '19 at 11:10
  • [That way, I work on machine that has Python 3.4. Though, I don't compile anything, I just script things for that machine.] – h4z3 Jul 08 '19 at 11:11

1 Answers1

0

Python is (infamously) really not a compiled language but an interpreted one. One notable caveat to this is that the Python interpreter will cache modules with .pyc files. Here is a more comprehensive summary of those modules. Of course if you're using py2exe, PyInstaller, or some other ad-hoc compiler then its possible that freezing the package as an executable will make it fragile to version changes.

Generally though, in between similar versions (e.g. 3.6 to 3.8) the changes to the standard library are small. If your package (or its dependencies) use some feature that has changed then you can expect it to no longer work and you'll need to update that part of your code. This is the changelog comparing features from 3.6 to 3.7 and the list of backwards incompatible changes is short:

  • async and await are now reserved keywords.

This is the changelog comparing 3.7 to 3.8 and it has some more subtle differences.

Andrew F
  • 2,690
  • 1
  • 14
  • 25