Skip to content

Add a simple way of resetting the accumulated timers #10

@gahjelle

Description

@gahjelle

Today, it's possible to reset the accumulated timers by clearing the timers dictionary:

Timer.timers.clear()

However, this may lead to errors if a timer has already been initialized (typically because it's used as a decorator and initialized at import-time). Therefore a better way is to explicitly set existing timers to 0:

Timer.timers.update({k: 0 for k in Timer.timers})

However, this becomes hard to read, and even harder to write.

A better solution would be to have explicit support for resetting the accumulated timers.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions