__author__
Peter L Hansen
peter at engcorp.com
Fri Oct 1 13:35:19 EDT 2004
Michael Hoffman wrote:
> Peter L Hansen wrote:
[re __version__]
>> Very many third party packages I have installed. It's
>> not that it is *consumed* by anything, but that it seems to
>> be a very widely used convention.
>
> Probably because Guido suggests it in the Python Style Guide, PEP 8:
>
> http://www.python.org/peps/pep-0008.html
Checking that page.... it appears the suggestion was more specific
than that:
"""If you have to have RCS or CVS crud in your source file, do it as
follows.
__version__ = "$Revision: 1.25 $"
# $Source: /cvsroot/python/python/nondist/peps/pep-0008.txt,v $
"""
Perhaps those who have used it for a more typical version number,
ala __version__ = '1.2.34', have expanded the usage beyond what
Guido recommended.
I suspect a majority of modules actually use VERSION in preference
to __version__, maybe because many authors didn't interpret the
PEP8 comment as widely as some did.
(I've tended to use VERSION, I believe, but I'm moving towards
using a build.xml file containing a variety of meta-information
for the entire package, rather than an embedded constant.)
-Peter
More information about the Python-list
mailing list