Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Decorator Pattern</strong> - In object-oriented programming, the decorator pattern is a design pattern that allows behaviour to be added to an existing object dynamically. The decorator pattern can be used to extend (decorate) the functionality of a certain object at run-time, independently of other instances of the same class, provided some groundwork is done at design time.</p> <p><strong>Decorators in Python</strong> - Despite the name, Python decorators are not an implementation of the decorator pattern. The decorator pattern is a design pattern used in statically typed object-oriented programming languages to allow functionality to be added to objects at run time; Python decorators add functionality to functions and methods at definition time, and thus are a higher-level construct than decorator-pattern classes.</p> <p>The decorator pattern itself is trivially implementable in Python, because the language is duck typed, and so is not usually considered as such. So in Python a decorator is any callable Python object that is used to modify a function, method or class definition.</p> <p>I hope I made the difference clear. Just in case you did not completely understand, please go through these links. You will come out more than clear at the end of it -</p> <ul> <li><p><em><a href="https://stackoverflow.com/questions/739654/understanding-python-decorators">How to make a chain of function decorators?</a></em></p></li> <li><p><em><a href="https://stackoverflow.com/questions/3118929/implementing-the-decorator-pattern-in-python">Implementing the decorator pattern in Python</a></em></p></li> <li><p><em><a href="https://stackoverflow.com/questions/4229287/what-is-the-difference-between-using-decorators-and-extending-a-sub-class-by-inh">What is the difference between using decorators and extending a sub class by inheritance?</a></em></p></li> <li><p><em><a href="https://stackoverflow.com/questions/681953/python-class-decorator">Python Class Decorator</a></em></p></li> <li><p><em><a href="http://wiki.python.org/moin/PythonDecorators" rel="nofollow noreferrer">PyWiki - Python Decorators - A detailed discourse</a></em></p></li> <li><p><em><a href="http://www.ibm.com/developerworks/linux/library/l-cpdecor/index.html" rel="nofollow noreferrer">Python Decorators Made Easy</a></em></p></li> <li><p><em><a href="http://en.wikipedia.org/wiki/Decorator_pattern" rel="nofollow noreferrer">Source 1</a> &amp; <a href="http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Decorators" rel="nofollow noreferrer">source 2</a></em></p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload