From c639d069e24b5c9c8587976772b8f4b78f44f852 Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 7 Jun 2024 11:48:58 +0200 Subject: [PATCH] (pufka) decorator example 2 --- Python/decorator.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 Python/decorator.py diff --git a/Python/decorator.py b/Python/decorator.py new file mode 100755 index 0000000..51b95ec --- /dev/null +++ b/Python/decorator.py @@ -0,0 +1,23 @@ +#!/bin/python3 +def print_canary(): + print(''' .-. \n''' + + ''' /'v'\ \n''' + + ''' (/ \) \n''' + + '''='="="===<\n''' + + '''mrf|_| \n''', + end='' + ) + +myBirdFunction = print_canary +myBirdFunction() + +def print_with_yellow(func): + def wrapper(*args, **kwargs): + print("\033[33m") + r = func() + print("\033[0m") + return r + return wrapper + +myBirdFunction = print_with_yellow(print_canary) +myBirdFunction()