Jump to: navigation, search

Development Team/Code guidelines

409 bytes added, 13:46, 9 November 2010
Miscellaneous: add guidelines on strings, highlight code, add hint on string logging
== Miscellaneous ==
* Use <code>logging.debug('foo %r bar', x) </code> instead of <code>logging.debug('foo %r bar' % x)</code>. This is more robust and formatting only happens if we actually log something.* When logging strings, consider using <code>%r</code> instead of <code>%s</code> because <code>%r</code> will take care of quoting and escaping the string as needed
* When you catch an exception and want to log it, use logging.exception(), this will print the whole backtrace and exception information, which is very useful when debugging.
* "Short" string literals should use single quotes (<code>'</code>) unless the string contains a single quote (that would need to be escaped)
* "Long" string literals should use three double quotes (<code>"""</code>)
== Tools ==

Navigation menu