On Fri, Mar 18, 2011 at 8:12 PM, Toshio Kuratomi <a.bad...@gmail.com> wrote: > On Fri, Mar 18, 2011 at 07:40:43PM -0700, Guido van Rossum wrote: >> On Fri, Mar 18, 2011 at 7:28 PM, Greg Ewing <greg.ew...@canterbury.ac.nz> >> wrote: >> > Tres Seaver wrote: >> > >> >> I'm not even sure why you would want __version__ in 99% of modules: in >> >> the ordinary cases, a module's version should be either the Python >> >> version (for a module shipped in the stdlib), or the release of the >> >> distribution which shipped it. >> > >> > It's useful to be able to find out the version of a module >> > you're using at run time so you can cope with API changes. >> > >> > I had a case just recently where the behaviour of something >> > in pywin32 changed between one release and the next. I looked >> > for an attribute called 'version' or something similar to >> > test, but couldn't find anything. >> > >> > +1 on having a standard place to look for version info. >> >> I believe __version__ *is* the standard (like __author__). IIRC it was >> proposed by Ping. I think this convention is so old that there isn't a >> PEP for it. So yes, we might as well write it down. But it's really >> nothing new. >> > There is a section in PEP8 about __version__ but it serves a slightly > different purpose there: > > """ > Version Bookkeeping > > If you have to have Subversion, CVS, or RCS crud in your source file, do > it as follows. > > __version__ = "$Revision: 88433 $" > # $Source$ > > These lines should be included after the module's docstring, before any > other code, separated by a blank line above and below. > """
Ah, hm. Yes, that's way outdated. I don't think anyone believe in marking each file with its revision any more. I do distinctly recall __version__ being standardized for other purposes too, but I have no idea how to find that reference... It probably was well before 2000. > Personally, I've never found a need to access the repository revision > programatically from my pyhon applications but I have needed to access the > API version so it would make sense to me to change the meaning of > __version__. Agreed. I don't think that was the only allowed use of __version__ -- just the only mentioned use. (Note the conditional "If you have to have Subversion, ..." at the start of that paragraph in PEP 8.) -- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com