How would you like to MASTER graphic design by next week?
Click here to find out how
Featured Photoshop templates - professional ready to use designs for your next project
View all templates
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:
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.
Tips for readable python code
In this post I will try to explain some tricks I use to make python code more readable. These tips won’t make your code shorter and it won’t be better optimized, it will actually use more memory than before, but it will be much easier to understand and edit for someone else.
Avoid common querying mistakes with better Django models
This article sheds light on some of the lesser-known features of the Django ORM in particular, but SQLAlchemy users may find some of the cautions about inefficient query generation applicable to their own code. Learn how to avoid common querying mistakes, use model managers to encapsulate complex queries, and take advantage of the powerful new aggregation features available in Django V1.1
Python Squeezes the Web
This 5-page tutorial describes how to grab remote web pages and process them locally in Python. Useful for parsing information off the web.
Learning Pygame(simple 2d), part 2 Initializing the Board and Showing it
What we have now is the simplest of the simple(almost) of pygame programs.