Skip to content

Instantly share code, notes, and snippets.

@eezis
Created December 22, 2017 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eezis/5feb0028bf280619a7952f7b35c5384a to your computer and use it in GitHub Desktop.
Save eezis/5feb0028bf280619a7952f7b35c5384a to your computer and use it in GitHub Desktop.
Python: deprecate a module or function
"""
"""
import warnings
from decimal import *
warnings.warn("This unit is being deprecated, ....")
def round_off(value, dec_places=9 ):
return Decimal(value).quantize(Decimal('0.00000000'))
# if you want to deprecate a function instead of an entire module, just move the warning message
import warnings
from decimal import *
def round_off(value, dec_places=9 ):
warnings.warn("The round_off function will be deprecated, please use ....")
return Decimal(value).quantize(Decimal('0.00000000'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment