sort of a beginner question about globals

Duncan Booth duncan.booth at invalid.invalid
Thu Apr 14 09:34:09 EDT 2005


fred.dixon wrote:

> when i am roughing out my functions and classes i out a pass statement
> as my first line just as a place holder and a convenient place to put a
> break when i am testing. no other good reason.
> 

A better idea when roughing out functions and classes is to insert a 
docstring describing what the function is going to do. That way you don't 
have to use 'pass' at all, and you don't have to remember to remove 
anything when you later add code. Alternatively use 'raise 
NotImplementedError' to tell you at runtime if you hit any such functions.

'convenient place to put a break when testing' implies you test by stepping 
through with a debugger. You should consider writing unit tests as a way of 
reducing the amount of debugging you need to do.



More information about the Python-list mailing list