Styling Temporary Code

Kimberly Belli kbelli at coe.neu.edu
Thu Jun 1 15:13:14 EDT 2000


On Thu, 1 Jun 2000, Pete Shinners wrote:

> I've been developing in C for several years and have
> really been enjoying python recently.
> 
> one thing i do frequenctly in C is to place temporary
> "debug/doublecheck/sanity" type code while i'm developing
> it. i always put this code in with no indenting, so it's
> easy to spot, work with, and cleanup. it looks something
> like this...

Why not use the method the librarians used to make us do so we knew where
to put the books back on the shelves?

Yeah, it might not be as pretty, but it's a suggestion ;)

 int myfunc(int nullargs)
 {
     int newval = do_fancy_stuff(nullargs);
#  
     cout << "newval = " << newval << endl;
# 
     return more_fancy(newval);
 }

...or with comments....

 int myfunc(int nullargs)
 {
     int newval = do_fancy_stuff(nullargs);
# I think maybe I have a clue
     cout << "newval = " << newval << endl;
# phew! back to stuff I know.
     return more_fancy(newval);
 }

Good luck finding something that works!

Kim.




More information about the Python-list mailing list