Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

decorators in python

# this functon converts any string into uppercase
def deco(function):
    def wrap(s):
        return s.upper()
        function(s)
    return wrap

@deco
def display(s):
    return s 
print(display("not bad"))
Source by www.interviewbit.com #
 
PREVIOUS NEXT
Tagged: #decorators #python
ADD COMMENT
Topic
Name
8+5 =