Top "Decorator" questions

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

Decorators in Ruby (migrating from Python)

I'm spending today learning Ruby from a Python perspective. One thing I have completely failed to grapple with is an …

ruby decorator
How can make Django permission_required decorator not to redirect already logged-in users to login page, but display some message

How can make Django permission_required decorator not to redirect already logged-in users to login page, but display some message …

django decorator django-authentication
Design pattern that Wrapper Classes use in Java?

I have found an old post which does not clarify my understanding about the design patterns that are used by …

design-patterns adapter decorator wrapper facade
Difference between Decorator pattern and Delegation pattern

What is the difference between Decorator pattern and Delegation pattern (if there is any) ? I don't want to know just …

java design-patterns decorator delegation
Possible to create a @synchronized decorator that's aware of a method's object?

I'm trying to create a @synchronized wrapper that creates one Lock per object and makes method calls thread safe. I …

python decorator python-decorators
How to mock a decorated function

For testing reasons, I need to be able to mock the inner/original function of a decorated one which is …

python unit-testing mocking decorator monkeypatching
Python - can I programmatically decorate class methods from a class instance?

I have an object hierarchy in which almost all of the methods are class methods. It looks like the following: …

python decorator class-method
Python logging using a decorator

This is the first example we meet when we face with decorators. But I'm not able to realize what exactly …

python logging introspection decorator
Design Patterns Chain of Resposibility Vs Decorator

How Chain of Responsibility Pattern Differs from Decorator Pattern..?

design-patterns decorator chain-of-responsibility
Get Python function's owning class from decorator

I have a decorator in PY. It is a method and takes the function as a parameter. I want to …

python class function decorator inspect