473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Documenting Python code.

Hi,

Are there any standarized ways of documenting Python code? When I check the
__doc__ attribute of the standard modules, the results are kind of plain. Is
everyone using this style?

Since Python is a very powerful language parsing strings, replacing
expressions, and processing XML, I was wondering if people documents the
code using constructs similar to JavaDoc and then use some functions to
display the documentation with a little bit more of structure.

Python is a dynamically typed language, which makes me think of the
importance of documenting not only the purpose of a particular function or
class method, but also what requirements should be met by the objects passed
as parameters, what will the function return, and what type of erros can
happen. I don't see any of this information in the __doc__ attributes, so I
was wondering if people is using some other way to document their code.

If there is no standard way to do this inside the Python community, does
anyone feels there is a need for standarizing it?

Thanks,

--
Isaac Rodriguez
SWE Autodesk.
========================================
There are 10 types of people.
Those who undertand binary, and those who don't
Jul 19 '05 #1
5 1943
I would say reStructuredText is the preferred format
for documenting Python code. Google is your friend.

Michele Simionato

Jul 19 '05 #2
Isaac Rodriguez wrote:
Python is a dynamically typed language, which makes me think of the
importance of documenting not only the purpose of a particular function or class method, but also what requirements should be met by the objects passed as parameters, what will the function return, and what type of erros can happen. I don't see any of this information in the __doc__ attributes, so I was wondering if people is using some other way to document their code.


I guess you're talking about something like literate programming.
If so, doctest module may be useful for that purpose. Doctest can also
be used as a unittest.

--
george

http://www.dynkin.com/
Jul 19 '05 #3

Have a look at Epydoc (http://epydoc.sourceforge.net/), a documentation
system
that generates HTML and PDF docs. Plain text, Javadoc,
ReStructuredText,
and Epytext docstrings are handled gracefully.

ReStructuredText (or a suitable subset of RST) is probably the best
choice IMHO.

SB

Jul 19 '05 #4
Isaac Rodriguez wrote:
Are there any standarized ways of documenting Python code? When I check the
__doc__ attribute of the standard modules, the results are kind of plain. Is
everyone using this style?


See <http://epydoc.sourceforge.net/>. Epydoc has a simple language for
documentation that can markup type information for paramaters and other
stuff like that.
Jul 19 '05 #5
Isaac Rodriguez wrote:
Since Python is a very powerful language parsing strings, replacing
expressions, and processing XML, I was wondering if people documents the
code using constructs similar to JavaDoc


if you want something very similar to JavaDoc, you can use PythonDoc:

http://effbot.org/zone/pythondoc.htm

</F>

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rony | last post by:
A question on python source documentation. Does there exist a standard for documenting code ? I've included here an example generated by pydoc of one of my modules. Is this the right way or is it...
2
by: Lasse Vågsæther Karlsen | last post by:
I notice that if I use this syntax: def classname: ... ## # closes the database connection and releases the resources. def close(self): .... ##
17
by: Jelmer | last post by:
Hi, I am mildly familiar with ms access developement and I have been asked to port and document a ms access app. I expect the porting (97 to XP) to be fairly straightforward. However documenting...
1
by: strauss.sean | last post by:
I have been asked to begin documenting the ongoing development and changes to a database that I maintain. Not the entry of data; this is about the changes to how tables are restructured, and any...
13
by: Jeff Rodriguez | last post by:
What sort of documentation do you do on your code? I've never done any code development on a big project and I want to start documenting my code in a way that makes sense, is easy to understand,...
1
by: Brett | last post by:
I'd like to have all of my documentation in one place. I use the following for documenting code: - attributes for certain types of documentation - use of the C# generated inline XML...
8
by: Spleenwort | last post by:
With regard to XML comments in c#. I think that #regions should be self-documenting relative to XML comments or that a <region> tag should be defined and auto-inserted when you type #region...
3
by: Rob Cowie | last post by:
I have searched this group and the wider net to find an answer to this, but I haven't been successful. Pydoc seems to be capable of writing documentation for all modules within a package by...
2
by: sajithamol | last post by:
What is a Self Documenting Code? wheather java is a self documenting code?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.