Top "Decorator" questions

Decorator is an object-oriented design pattern that allows adding behavior to existing classes in a dynamic fashion.

What are "decorators" and how are they used?

I'm curious what exactly decorators are in AngularJS. There isn't much information online for decorators save for a blurb in …

javascript angularjs decorator angularjs-decorator
How to write a custom decorator in django?

The problem - @is_premium_user def sample_view: ....... ...... I want certain views accesible to only the premium users of …

python django permissions decorator
Can a decorator of an instance method access the class?

I have something roughly like the following. Basically I need to access the class of an instance method from a …

python decorator
Use Cases and Examples of GoF Decorator Pattern for IO

I have read in wikipedia that Decorator pattern is used for .Net and Java IO classes. Can anybody explain how …

java .net design-patterns io decorator
Determining if root logger is set to DEBUG level in Python?

If I set the logging module to DEBUG with a command line parameter like this: if (opt["log"] == "debug"): logging.…

python logging decorator
Can I patch a Python decorator before it wraps a function?

I have a function with a decorator that I'm trying test with the help of the Python Mock library. I'd …

python unit-testing mocking decorator monkeypatching
Differences between Proxy and Decorator Pattern

Can you give any good explanation what is the difference between Proxy and Decorator? The main difference I see is …

oop design-patterns decorator proxy-pattern
Angular2 Component @Input two way binding

I have a data driven Angular application. I have a toggle component which I pass in a toggled state. My …

angular typescript data-binding components decorator
Multithreading for Python Django

Some functions should run asynchronously on the web server. Sending emails or data post-processing are typical use cases. What is …

python django multithreading decorator python-multithreading
General decorator to wrap try except in python?

I'd interacting with a lot of deeply nested json I didn't write, and would like to make my python script …

python try-catch wrapper decorator