Aim Python Library Master (47) Deckor

[Description de la bibliothèque]

Des décorateurs utiles peuvent être utilisés

【programme】

deckor.py


# -*- coding: utf-8 -*-

import deckor

@deckor.timer
def fact(x):
    if x <= 0:
        return 1
    return x*fact(x-1)
    
fact(5)
'''
Time: 0.000000s
Time: 0.000000s
Time: 0.000000s
Time: 0.000000s
Time: 0.000000s
Time: 0.000000s
120
'''
    
@deckor.cacheit
def fact(x):
    if x <= 0:
        return 1
    return x*fact(x-1)
    
fact(5)
# 120
    
@deckor.trace
def fib(x):
    if x < 2:
        return x
    return fib(x-1)+fib(x-2)

print fib(5)
'''
|--> fib(5)
|    |--> fib(4)
|    |    |--> fib(3)
|    |    |    |--> fib(2)
|    |    |    |    |--> fib(1)
|    |    |    |    |    |--> return 1
|    |    |    |    |--> fib(0)
|    |    |    |    |    |--> return 0
|    |    |    |    |--> return 1
|    |    |    |--> fib(1)
|    |    |    |    |--> return 1
|    |    |    |--> return 2
|    |    |--> fib(2)
|    |    |    |--> fib(1)
|    |    |    |    |--> return 1
|    |    |    |--> fib(0)
|    |    |    |    |--> return 0
|    |    |    |--> return 1
|    |    |--> return 3
|    |--> fib(3)
|    |    |--> fib(2)
|    |    |    |--> fib(1)
|    |    |    |    |--> return 1
|    |    |    |--> fib(0)
|    |    |    |    |--> return 0
|    |    |    |--> return 1
|    |    |--> fib(1)
|    |    |    |--> return 1
|    |    |--> return 2
|    |--> return 5
5
'''

[Site de référence]

pypi  github

Recommended Posts

Aim Python Library Master (47) Deckor
Aim Python Library Master (48) Autopep8
Aim Python Library Master (36) json2html
Aim Python Library Master (49) psidialogs
Aim Python Library Master (26) easyxml
Aim python library master (29) table_printer
Espaces de noms Aim Python Library Master (55)
AIM Python Library Master (46) BrowserPlus
Aim Python Library Master (30) Chronyk
Aim Python Library Master (42) Speedrecorder
Aim Python Library Master (37) Slimurl
Aim Python Library Master (44) pynetviz
Aim Python Library Master (8) Rolex
Aim Python Library Master (52) Marktime
Aim Python Library Master (7) Numparser
Aim Python Library Master (21) hy
Viser les requêtes du maître de bibliothèque python (18)
Aim Python Library Master (20) Pyyaml
Aim Python Library Master (34) simultané
Aim Python Library Master (43) cpmoptimize
Aim Python Library Master (68) pazudorasolver
Aim Python Library Master (58) Faker
Aimez le maître de la bibliothèque python (38) beautiful_print
Aim Python Library Master (65) Geopy
Aim Python Library Master (2) Vincenty
Journal de bord Aim Python Library Master (59)
Aim Python Library Master (51) Pyautogui
Aim Python Library Master (0) Liens
Aim Python Library Master (53) psutil
Aim Python Library Master (22) HTMltag
Aim Python Library Master (67) httpie
Aim Python Library Master (45) xlsxwriter
Aim Python Library Master (9) WebHelpers
Aim Python Library Master (32) SQL
Aim Python Library Master (60) Colourettu
Viser maître de la bibliothèque python (64) pretty_cron
Aim Python Library Master (56) colorthief
Aim Python Library Master (17) Rangeparser
Aim Python Library Master (25) Orderset
Viser le maître de la bibliothèque python (62)
Aim Python Library Master (12) Excel
Aim Python Library Master (24) combi
Aim Python Library Master (63) EasyGui
Aim Python Library Master (19) Riemann
Aim Python Library Master (39) Goless
Aim Python Library Master (54) tqdm
Aim Python Library Master (16) byteplay
Aim Python Library Master (23) memory_utils
AIM Python Library Master (27) Benchit
Visez le maître de la bibliothèque python (35) pywildcard
Aim Python Library Master (14) Pyknon
Aim Python Library Master (15) Brute
Aim Python Library Master (50) xlwings
Aim Python Library Master (31) Adipy
Aim Python Library Master (57) Browsergui
Aim Python Library Master (1) da-vinci
Aim Python Library Master (33) convivial pour l'homme
Aimez le maître de la bibliothèque python (4) Ascii Py
Aim Python Library Master (28) Expressions verbales
Aim Python Library Master (5) tables de terminaux
Aim Node.js Library Master (3) python-runner