view pcombinators/util.py @ 69:f6c53dea71f2 draft

Add util module with decorator for benchmarking
author Lewin Bormann <lbo@spheniscida.de>
date Sat, 25 May 2019 14:50:26 +0200
parents
children 40f9e05d8f06
line wrap: on
line source

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 23 22:34:33 2019

@author: lbo
"""

import time

def time_it(f):
    def f_(*args, **kwargs):
        before = time.time()
        r = f(*args, **kwargs)
        print(f, time.time()-before)
        return r
    return f_