Why do some Python standard library modules have __version__ lines?

By chance, I noticed that csv and re in the modules of the python standard library have the .__version__ attribute:

 >>> import re, csv >>> re.__version__ '2.2.1' >>> csv.__version__ '1.0' 

This surprises me as they are part of the standard library, so I expect that their version will be determined by sys.version (and sys.version_info ).

I noticed that the attribute values ​​are the same for Python 2.7.13 and 3.6.1, despite the fact that the modules have been changed.

Are they just a kind of "code fossil" or are they somehow meaningful, and should programmers pay attention to their values?

+5
source share
1 answer

I can assume that the original version of the module in C has not changed, only the source code of the python module has changed in different versions of python itself. Finding the source code in a python repository can shed light on the whole situation.

For instance:

+1
source

Source: https://habr.com/ru/post/1272754/


All Articles