Last active
November 20, 2016 09:32
-
-
Save textbook/8605b73c1dda33a36cc8a526bbd0223f to your computer and use it in GitHub Desktop.
Non-data descriptors as applied to http://stackoverflow.com/q/40695883/3001761
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERB_QUIET = 0 | |
class VerbosityLevel(object): | |
def __init__(self, level): | |
self.level = level | |
def __get__(self, obj, _): | |
return obj.level >= self.level | |
class Verbosity(object): | |
"""Class used to determine what to print to standard output. | |
Attributes: | |
level: Determines what level of output to print. | |
""" | |
def __init__(self, level=VERB_QUIET): | |
self.level = level | |
quiet = VerbosityLevel(VERB_QUIET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment