Code anntotations (copyright, autor, etc) in your code

Tim Daneliuk tundra at tundraware.com
Thu Mar 26 22:04:46 CET 2009


mattia wrote:
> Hi all, which are the usual comments that you put at the beginning of 
> your code to explain e.g. the author, the usage, the license etc?
> 
> I've found useful someting like:
> #-----------------------------------------------------------------------------
> # Name:        About.py
> # Purpose:
> #
> # Author:      
> #
> # Created:     2009
> # Copyright:   (c) 2009
> # Licence:     GPL
> #-----------------------------------------------------------------------------
> 
> others put something like
> 
> __author__ = "Name Surname"
> __year__   = 2009
> 
> What do you use?

Something along these lines:

--------------------------------------------------------------------
#!/usr/bin/env python
# twander - Wander around the file system
# Copyright (c) 2002-2007 TundraWare Inc.  All Rights Reserved.
# For Updates See:  http://www.tundraware.com/Software/twander

# Program Information

PROGNAME = "twander"
RCSID    = "$Id: twander.py,v 3.224 2007/01/11 07:08:31 tundra Exp tundra $"
VERSION  = RCSID.split()[2]

# Copyright Information

DATE         = "2002-2007"
CPRT         = "(c)"
OWNER        = "TundraWare Inc."
RIGHTS       = "All Rights Reserved."
COPYRIGHT    = "Copyright %s %s %s  %s" % (CPRT, DATE, OWNER, RIGHTS)

-----------------------------------------------------------------------

I make later use of the VERSION and COPYRIGHT variables in help displays,
menu titles, and so on...



-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list