Decorator គឺជាវត្ថុទាំងឡាយណា ដែលមានសមត្ថភាពអាចយក mothod ឬ function ណាមួយ មកកែលំអអោយទៅជាវត្ថុផ្សេងទៀត។ ពនិត្យកម្មវិធីខាងក្រោមនេះ៖
class Cash():
    def toStaticMethod(method):
        method = staticmethod(method)
        return method
    def toClassMethod(method):
        method = classmethod(method)
        return method
    @toClassMethod
    def setClassAttribute(cl, data):
        cl.data = data
    @toStaticMethod
    def display():
        print(Cash.data)
money = Cash()
money.setClassAttribute(1000)
Cash.display()
1000


 
 
 
 
 












