Skip to content Skip to sidebar Skip to footer
Showing posts with the label Decorator

Python Resettable Instance Method Memoization Decorator

I'm attempting to build a decorator for an instance method of a class that will memoize the res… Read more Python Resettable Instance Method Memoization Decorator

Python: __qualname__ Of Function With Decorator

I'm using a Decorator (class) in an Instance method of another class, like this: class decorato… Read more Python: __qualname__ Of Function With Decorator

Is There A Way To Run A Method Automatically On The Initialization Of An Instance Without Using __init__?

I am writing some unit tests with Pytest. If I want them to be collected automatically, I have to … Read more Is There A Way To Run A Method Automatically On The Initialization Of An Instance Without Using __init__?

Class Decorator For Methods From Other Class

NOTE: I've got a related question here: How to access variables from a Class Decorator from wit… Read more Class Decorator For Methods From Other Class

Use A Class Decorator To Implement Late-initialization

I am using some classes which need to connect to databases. The connection is only really needed wh… Read more Use A Class Decorator To Implement Late-initialization

Python Decorator Function Called At Compile Time

I hope that someone familiar with Python's compilation / run-time procedures could shed some li… Read more Python Decorator Function Called At Compile Time

Accessing Function Attribute Created In A Decorator Outside That Decorator

I want to count the number of times a given function has been called. So, I made a countcalls decor… Read more Accessing Function Attribute Created In A Decorator Outside That Decorator

Python Decorator For Attribute And Method?

Is it possible to have a decorator that makes a method work like an attribute if values are assigne… Read more Python Decorator For Attribute And Method?

Functools.update_wrapper() Doesn't Work Properly

I use Functools.update_wrapper() in my decorator, but It seems like update_wrapper rewrites only fu… Read more Functools.update_wrapper() Doesn't Work Properly

Python Decorator With Arguments And Accessing Class Instance

I have a class defined as follows: class SomeViewController(BaseViewController): @requires('… Read more Python Decorator With Arguments And Accessing Class Instance

Get Decorated Function Object By String Name

def log(func): def wraper(*a, **kw): return func(*a, **kw) return wraper @log d… Read more Get Decorated Function Object By String Name

"@" Decorator (in Python)

Possible Duplicate: Understanding Python decorators What function does the 'class decorator&#… Read more "@" Decorator (in Python)

Add A Decorator To Existing Builtin Class Method In Python

I've got a class which contains a number of lists where whenever something is added to one of t… Read more Add A Decorator To Existing Builtin Class Method In Python

Wrapping Class Method In Try / Except Using Decorator

I have a general purpose function that sends info about exceptions to an application log. I use the… Read more Wrapping Class Method In Try / Except Using Decorator