chrisphan.com

Silly Decorator #1: @a_hole

An analog clock reading 5:002022-03-23 / 2022-W12-3T17:00:00-05:00 / 0x623b9860

Categories: programming, fun, silly decorator

I'm like a pâtissier, except I decorate functions instead of cakes, and I decorate with U+1F4A9 instead of frosting.

Python (REPL)
from aholedecorator import a_hole
@a_hole
def hello(name: str = "friend") -> str:
    return f"Hello {name}, I hope you are well."

hello()
'Hello friend, I hope you are well.'
hello()
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/chris/Documents/projects/gists/a_hole_decorator/aholedecorator.py", line 70, in new_func
    raise AHoleError(choice(_MESSAGES))
aholedecorator.AHoleError: I'm like a pâtissier, except I decorate functions
  instead of cakes, and I decorate with U+1F4A9 instead of frosting.

(Source)