PHB-CS123 / graphene

CS123 Graph Database Project
Apache License 2.0
0 stars 0 forks source link

Implement timer pausing as a context manager. #35

Closed eugene-bulkin closed 8 years ago

eugene-bulkin commented 8 years ago

cc @codyhan94 @Davidpena

We want to make sure that restarting the timer after pausing is never forgotten, so the pause method has been made private, and the only option is now the paused method. This is used in a with statement like so:

Old Usage:

  timer.pause()
  print "foo"
  timer.start()

New Usage:

with timer.paused():
    print "foo"

All printer statements should be wrapped in these with statements.