Created
November 4, 2018 02:50
-
-
Save JackInTaiwan/6f70279c19ed337a58c875f8f2f75cae to your computer and use it in GitHub Desktop.
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
class Dog: | |
def __init__(self, func): | |
self.age = 10 | |
self.talent = func | |
def bark(self): | |
print("Bark !!!") | |
@Dog | |
def dog_can_pee(): | |
print("I can pee very hard......") | |
if __name__ == "__main__": | |
dog = dog_can_pee | |
print(dog.age) | |
# > 10 | |
dog.bark() | |
# > Bark !!! | |
dog.talent() | |
# > I can pee very hard...... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment