Skip to content

Instantly share code, notes, and snippets.

@ChrisBeaumont
Created September 16, 2015 17:43
Show Gist options
  • Save ChrisBeaumont/ebdb98647150e7263bdd to your computer and use it in GitHub Desktop.
Save ChrisBeaumont/ebdb98647150e7263bdd to your computer and use it in GitHub Desktop.
import sys
import warnings
class DeprecatedAttribute(object):
def __init__(self, name, value):
self.name = name
self.value = value
def __get__(self, instance, owner):
warnings.warn("%s is deprecated" % self.name)
return self.value
def __set__(self, instance, value):
self.value = value
class Module(object):
client = DeprecatedAttribute('client', 5)
sys.modules[__name__] = Module()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment