Recently, I saw the following piece of code in a python script:
#!/usr/bin/env python
__svnversion__ = '$Id: setup.py 303 2010-10-20 02:51:64Z xyz $'
import sys
It seems that it is a way to somehow keep track of version of the script in the SVN but I exactly don’t know why and how it is used?. Where can I read more in general about this style of coding and why people use it?
It doesn’t mean anything; the author of that program just decided to create a variable with that name.
The
'$Id: setup.py 303 2010-10-20 02:51:64Z xyz $'bit allows svn to automatically update the version number; presumably somewhere else in the code this value is displayed or sent with debugging output or something.PEP 8 suggests putting this in
__version__, but rather disparagingly (“If you have to have […] crud”).