Skip to content

Instantly share code, notes, and snippets.

@sf105
sf105 / mutable_variables.py
Created December 27, 2022 18:33
Code coverage for mutable variables
# I've developed an unreasonable preference for helper functions over mutable
# variables. It turns out that there's one good reason why. This version of the
# code shows full code coverage.
topics = []
if part_of_a_group:
topics = collected_works()
publish(topics)
# In this version of the code, the coverage tool shows that the "false" branch