Top "Python-decorators" questions

In Python, decorators are functions that conveniently alter functions, methods or classes using a special syntax.

Difference between staticmethod and classmethod

What is the difference between a function decorated with @staticmethod and one decorated with @classmethod?

python oop methods python-decorators
How does the @property decorator work in Python?

I would like to understand how the built-in function property works. What confuses me is that property can also be …

python properties decorator python-decorators python-internals
How to make function decorators and chain them together?

How can I make two decorators in Python that would do the following? @makebold @makeitalic def say(): return "Hello" ...which …

python decorator python-decorators
What does the "at" (@) symbol do in Python?

I'm looking at some Python code which used the @ symbol, but I have no idea what it does. I also …

python syntax python-decorators
Class method decorator with self arguments?

How do I pass a class field to a decorator on a class method as an argument? What I want …

python python-decorators
Real world example about how to use property feature in python?

I am interested in how to use @property in Python. I've read the python docs and the example there, in …

python oop properties python-decorators
How do I pass extra arguments to a Python decorator?

I have a decorator like below. def myDecorator(test_func): return callSomeWrapper(test_func) def callSomeWrapper(test_func): return test_…

python python-2.7 python-decorators
How to use Python decorators to check function arguments?

I would like to define some generic decorators to check arguments before calling some functions. Something like: @checkArguments(types = ['int', …

python python-decorators
Decorating Python class methods - how do I pass the instance to the decorator?

This is Python 2.5, and it's GAE too, not that it matters. I have the following code. I'm decorating the foo() …

python python-decorators
Decorator execution order

def make_bold(fn): return lambda : "<b>" + fn() + "</b>" def make_italic(fn): return lambda : "<…

python decorator python-decorators