Subscribe
Tutorial search

Python: Using doctest for Documentation - Python tutorial


Python provides the useful ability to embed comments inside functions that are accessible from a Python shell. These are known as docstrings. A docstring provides the ability to embed not only information, but also code samples that are runnable.In this article, we will explore different ways to use doctest to develop documentation. In this article by Greg Lee Turnquist, author of Python Testing Cookbook, we will cover: •Documenting the basics •Catching stack traces •Running doctests from the command line •Printing out all your documentation including a status report
Category: Python tutorials - Difficulty:


More cool Python tutorials:



Python 101 - Introduction to Python
Python 101 - Introduction to Python
This document is a syllabus for a first course in Python programming. This course contains an introduction to the Python language, instruction in the important and commonly used features of the language, and practical excercises in the use of those features.
Difficulty:
Charming Python: Text processing in Python for beginners
Charming Python: Text processing in Python for beginners
Along with several other popular scripting languages, Python is an excellent tool for scanning and manipulating textual data. This article summarizes Python's text processing facilities for the programmer new to Python. The article explains some general concepts of regular expressions and offers advice on when to use (or not use) regular expressions while processing text.
Difficulty:
Scaling Django web apps on Apache
Scaling Django web apps on Apache
Django is a lightweight framework with vibrant community surrounding it. Create a simple Django application and learn how to deploy it to the Web on a server running Apache and mod_python. Finally, learn how Django applications can and should be scaled as your application's requirements grow.
Difficulty:
Simple Python event class
Simple Python event class
For example if you are building IRC bot and it supports scripting, the scripts should be able to register handlers on the event.
Difficulty:
Learn Best Practices for Designing, Coding, and Distributing Python Software
Learn Best Practices for Designing, Coding, and Distributing Python Software
Writing code in Python is simple, however, writing code that is efficient and easy to maintain and reuse is not so straightforward. This is where this book intends to step in. Written by Tarek Ziadé, a contributor to the Zope code and an experienced Python developer,
Difficulty: