• 13

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Writing copyright information in python code

What is the standard way of writing "copyright information" in python code? Should it be inside docstring or in block comments? I could not find it in PEPs.

Some projects use module variables like __license__, as in:

__author__ = "Software Authors Name"
__copyright__ = "Copyright (C) 2004 Author Name"
__license__ = "Public Domain"
__version__ = "1.0"

Seems like a pretty clean solution to me (unless you overdo it and dump epic texts into these variables), but only __version__ seems to be in widespread use, as it is mentioned in PEP 8.

  • 27
Reply Report
# Comment in the beginning of the file

At least python built-in modules do this. (found out by doing grep 'Copyright' /usr/lib64/python2.4/*.py)

  • 13
Reply Report
    • @Shefali was asking for 'the standard way of writing "copyright information"' not whether it necessary to write the information. That's why I think my downvote is justified, while yours looks like a spiteful revenge.

As I know, there is currently no standard way. Each company/organization will have their own template to doc the copyright information. If this is your personal project, then just feel free to doc it in the way you feel most comforable. Adding a LICENSE file is a very common way for projects with many source files. Even in Python, there is currently no standard on the structure of docstrings.

Python provides a lot of freedom, so just let it be dude ;)

  • 2
Reply Report
      • 2
    • I get that many may do this differently... but the point of including a license is to avoid legal matters down the road... I don't think just let it be is good advice to give on such things :/

We follow the recommendations found (somewhere) on the Software Freedom Law Center's site. Here is an example of a simple GPL'ed file.

  • 2
Reply Report
      • 1
    • Looks like there are no guidelines specified for it anywhere in python docs or PEPs, but the above notation is widely used and accepted. Thanks!
      • 2
    • Its kinda frowned upon to give links without explanation on SO. Perhaps explain what the example is. In this case, a copyright notice and full license was included at the top of the file using comments (not doc strings).

Trending Tags