Chad Vernon
  • Home
  • Reel/Resume
  • Work
  • Resources
  • About
  • Contact
Home » Resources » Python Scripting for Maya Artists » Documenting Your Code
sideBar

Search

Categories

  • CG
  • cvxporter
  • Maya
  • Personal

Archives

  • July 2010
  • May 2010
  • April 2010
  • March 2010
  • December 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007

Rss

  • Main Entries RSS
  • Comments RSS

Documenting Your Code

You have seen me putting in comments in most of my samples. These not only help other people understand your code but will also help you remember what you were thinking when you revisit your scripts months later to fix something. Comments not only explain your code, but also explain how to use your code or functions that you want others to use.

Python supports a method of creating documentation for your modules known as docstrings. Docstrings are strings written with triple quotes (“””) and can be placed at the top of modules and inside functions. When you type help(moduleName), Python will print some nice documentation using the docstrings that you specified in your module.

Figure 13 - Documenting Your Code

Figure 13 - Documenting Your Code

You should try to put docstrings in your code as much as possible. It will save you and your coworkers a lot of time down the road.

Home » Resources » Python Scripting for Maya Artists » Documenting Your Code

© 2010 Chad Vernon