Potentially useful code snippets
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
510 B

#import numpy as np
#import time
import math
from math import tan as qe
def deco(func):
def wrapper(y):
ang = y *2 *math.pi/360
return func(ang)
return wrapper #You need two returns! So confusing!
def test(number):
return number
@deco
def test2(number):
return number
print('undecorated')
print(test(45))
print('decorated')
print(test2(45))
print('math.tan')
print(qe(45))
print('math.tan decorated')
test3=deco(qe)
print(type(test3))
print(test3(45))
print(math.tan(45))