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?