mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-02 23:05:20 -04:00
clean up
This commit is contained in:
parent
1ef64d6e17
commit
e0eb554dfd
279 changed files with 24267 additions and 0 deletions
19
First_edition_2014/ebook_src/learning/decorator.py
Normal file
19
First_edition_2014/ebook_src/learning/decorator.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/python
|
||||
#
|
||||
# An example of Python Decorator
|
||||
#
|
||||
|
||||
def pretty_sumab(func):
|
||||
def inner(a,b):
|
||||
print(str(a) + " + " + str(b) + " is ", end="")
|
||||
return func(a,b)
|
||||
|
||||
return inner
|
||||
|
||||
@pretty_sumab
|
||||
def sumab(a,b):
|
||||
summed = a + b
|
||||
print(summed)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sumab(5,3)
|
Loading…
Add table
Add a link
Reference in a new issue