Last active
July 6, 2018 02:24
-
-
Save santosh/4ca706d9c16c201abd658bdd96082958 to your computer and use it in GitHub Desktop.
#Python Decorators. #SelfRef
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
def addOne(oldFunc): | |
def addOneInside(*args, **kwargs): | |
return oldFunc(*args, **kwargs) + 1 | |
return addOneInside | |
@addOne | |
def someFunct(x): | |
return x | |
print(someFunct(66)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment