Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why there are __version__ strings in some modules of Python standard library?

By accident I noticed that both csv and re modules of python standard library have their .__version__ attribute:

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

It surprises me as they are part of the standard library, so I would expect their version to be defined by sys.version (and sys.version_info).

I have noticed the values of the attributes are same for both Python 2.7.13 and 3.6.1, despite the modules have changed.

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

like image 529
abukaj Avatar asked Nov 08 '22 15:11

abukaj


1 Answers

I can assume that the source version of the module on C did not change, only the source code of the python module has changed across different versions of python itself. Looking for source code in python repository can shed light into whole situation.

For example:

  • CSV C source code
  • CSV Python source code
like image 115
Yaroslav Surzhikov Avatar answered Nov 14 '22 22:11

Yaroslav Surzhikov