Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Python class that only prints unique files. Useful for debugging inner loops.
class PrintUnique(object):
A class that keeps track of what it has printed to stdout and won't
print anything twice.
printed = set()
def write(cls, s):
Prints a string if it hasn't been printed before.
if s not in cls.printed:
print s
def reset(cls):
cls.printed = set()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.