Ad
Code
Diff
  • class Greetings(object):
    
        def __init__(self, the_greeter):
            self.the_greeter = the_greeter
    
        def __call__(self, *args, **kwargs):
            return '{} World'.format(self.the_greeter.__name__)
    
    @Greetings
    def Hello():
        pass
    
    # Hello()
    • def hello_world():
    • return "Hello World"
    • class Greetings(object):
    • def __init__(self, the_greeter):
    • self.the_greeter = the_greeter
    • def __call__(self, *args, **kwargs):
    • return '{} World'.format(self.the_greeter.__name__)
    • @Greetings
    • def Hello():
    • pass
    • # Hello()