Tip: Use string literals instead of the pass statement?

The pass statement is simply used where the Python syntax requires a statement, but the application doesn't need any logic. Typically it is accompanied by a comment explaining why it is there. A simple example:
# my custom exception
class MyException(Exception):
    pass

if condition:
   pass # we don't need this right now - testing
More often than not I will use a triple quoted string in its place. This makes it more self documenting and looks cleaner to me. My preferred usage:
class MyException(Exception):
    """my custom exception"""

if condition:
   "we don't need this right now - testing"
What do you prefer?
blog comments powered by Disqus