Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#include <sys/time.h> // for gettimeofday() | |
class StopWatch { | |
timeval started; | |
std::string msg; | |
public: | |
StopWatch(const std::string& m): msg(m) | |
{ gettimeofday(&started, NULL); } |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!