Livingdeadの日記: Pythonのコード規約
コード規約というかスタイル上のガイドラインというか。
某掲示板で話題にあがっていたのだが、自分も前から気になっていた。
特に __author__ とか __version__ とか __date__ とか。
あと __doc__ (docstring) の中身の書き方とか。
まず某掲示板でリンクされていたのがこれ。
How do I organize my modules (source files)?
__author__ = "Rob Knight, Gavin Huttley, and Peter Maxwell"
__copyright__ = "Copyright 2007, The Cogent Project"
__credits__ = ["Rob Knight", "Peter Maxwell", "Gavin Huttley", "Matthew Wakefield"]
__license__ = "GPL"
__version__ = "1.0.1"
__maintainer__ = "Rob Knight"
__email__ = "rob@spot.colorado.edu"
__status__ = "Production"Status should typically be one of "Prototype", "Development", or "Production". __maintainer__ should be the person who will fix bugs and make improvements if imported. __credits__ differs from __author__ in that __credits__ includes people who reported bug fixes, made suggestions, etc. but did not actually write the code.
Python Coding Guidelines
docstring (__doc__)のスタイルなど関連するPEP文書としては
This document gives coding conventions for the Python code comprising the standard library in the main Python distribution.
PEP 8 -- Style Guide for Python Code
の他
PEP 256 -- Docstring Processing System Framework、PEP 257 -- Docstring Conventions、PEP 258 -- Docutils Design Specificationあたり。
その他 Google 系というか GSoC がらみというか Google App Engine がらみでは
The SoC framework, and Melange web applications built upon it, are implemented in Python (since that is the only programming language currently supported by Google App Engine). This style guide is a list of dos and don'ts for Python contributions to the Melange project.
PythonStyleGuide - soc - Style guide for Python code contributed to Melange - Project Hosting on Google Code
Pythonのコード規約 More ログイン