__author__

Peter L Hansen peter at engcorp.com
Fri Oct 1 11:05:16 EDT 2004


David Keeney wrote:
> I see this set (or similar) of variables in various modules I read. 
> They are found near the top of each module file, outside of any class
> or function definitions.
> 
> "
> __author__ = "Software Authors Name"
> __copyright__ = "Copyright (C) 2004 Author Name"
> __license__ = "Public Domain"
> __version__ = "1.0"
> "
> 
> What is the function of this set of variables?  I assume there are
> software products that use these, (Python itself, perhaps), that
> expect to find certain variables explained.
> 
> What are the expected variables, other than the ones listed above, and
> what software would I expect to use them?

IME, other than __version__, none of these are *widely* used,
nor are they necessary.

In any case, they are all just conventions, and there are NO
"expected variables" along the lines of what you're thinking,
and while there is probably some software that uses some
particular set of them, looking for such a thing just so
that you can throw a bunch of things like that at the top
of your modules, where they will never actually be used
(except for __version__), is a waste of time, IMHO.

*If* you want to write them that way, then use them in, say,
an About Dialog or when a "-h" option is specified, then go
ahead.  I personally use things like APP_AUTHOR and APP_COPYRIGHT
rather than the double-underscore convention, which in my
view makes them look like they are somehow "special" to
Python, causing just the sort of confusion that you have
faced here.  :-(

-Peter



More information about the Python-list mailing list