Created
December 22, 2017 20:17
-
-
Save eezis/5feb0028bf280619a7952f7b35c5384a to your computer and use it in GitHub Desktop.
Python: deprecate a module or function
This file contains 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
""" | |
""" | |
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