Christopher Tyler

Deprecated

Look at https://deprecated.readthedocs.io to use to deprecate parts of a program. I think this will be useful for libraries.

For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from deprecated import deprecated

@deprecated(version='1.2.0', reason="You should use another function")
def some_old_function(x, y):
    return x + y

class someClass:
    @deprecated(version='1.3.0', reason="This method is deprecated")
    def some_old_method(self, x, y):
        return x + y

<< Previous Post

|

Next Post >>

#Til #Python #Deprecated