mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-23 08:51:31 -04:00
reorganize dir
Signed-off-by: Mia Steinkirch <mia.steinkirch@gmail.com>
This commit is contained in:
parent
1b6f705e7c
commit
a8e71c50db
276 changed files with 23954 additions and 0 deletions
19
ebook_src/learning/decorator.py
Normal file
19
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