Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Lalande Microserf

View GitHub Profile
View aging_calculator.py
#!/usr/bin/env python3
from datetime import datetime
TARGETS = {
'Anthony': {
'dob': datetime(1982, 10, 19),
'aging_rate': 1
},
@Microserf
Microserf / function_decorator_to_method_decorator.py
Created Mar 14, 2017
A converter for turning a function decorator into a method decorator
View function_decorator_to_method_decorator.py
import functools
def make_method_decorator(decorator):
# This function returns a version of @decorator fit for wrapping a method
def method_wrapper(method):
@functools.wraps(method)
def inner_method(self, *args, **kwargs):
@decorator