Files
python-VM/learning/decorators/classes_with_args.py

73 lines
1.4 KiB
Python

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!')