adding all files done so far
This commit is contained in:
72
learning/decorators/classes_with_args.py
Normal file
72
learning/decorators/classes_with_args.py
Normal file
@@ -0,0 +1,72 @@
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.getcwd()) # noqa E402
|
||||
import decorator
|
||||
from itertools import repeat
|
||||
|
||||
# @slowDown(1)
|
||||
# def count_down(num: int):
|
||||
# if not isinstance(num, int):
|
||||
# raise TypeError("Must input an integer.")
|
||||
# if num >= 1:
|
||||
# print(num)
|
||||
# count_down(num - 1)
|
||||
# else:
|
||||
# print('Liftoff!')
|
||||
|
||||
|
||||
# @Counter
|
||||
# def say_howdy():
|
||||
# print('Howdy!')
|
||||
|
||||
|
||||
class tester(object):
|
||||
@decorator.slowDown()
|
||||
def count(self, num):
|
||||
if not isinstance(num, int):
|
||||
raise TypeError("Must input an integer.")
|
||||
if num >= 1:
|
||||
print(num)
|
||||
self.count(num - 1)
|
||||
else:
|
||||
print('Liftoff!')
|
||||
|
||||
# print()
|
||||
# var = tester()
|
||||
# var.count(1)
|
||||
|
||||
|
||||
# @decorator.slowDown()
|
||||
# def count(num):
|
||||
# if not isinstance(num, int):
|
||||
# raise TypeError("Must input an integer.")
|
||||
# if num >= 1:
|
||||
# print(num)
|
||||
# count(num - 1)
|
||||
# else:
|
||||
# print('Liftoff!')
|
||||
|
||||
|
||||
# print()
|
||||
# count(3)
|
||||
|
||||
# @decorator.slowDown
|
||||
# def count(num):
|
||||
# if not isinstance(num, int):
|
||||
# raise TypeError("Must input an integer.")
|
||||
# if num >= 1:
|
||||
# print(num)
|
||||
# count(num - 1)
|
||||
# else:
|
||||
# print('Liftoff!')
|
||||
|
||||
|
||||
# @slowDown
|
||||
# def countme(num):
|
||||
# if not isinstance(num, int):
|
||||
# raise TypeError("Must input an integer.")
|
||||
# if num >= 1:
|
||||
# print(num)
|
||||
# countme(num - 1)
|
||||
# else:
|
||||
# print('Liftoff!')
|
||||
Reference in New Issue
Block a user