Is it possible to pass types as function aguments as in the below example?
def test(*args):
'''decorator implementation with asserts'''
...
@test(str, int)
def fn1(ma_chaine, mon_entier):
return ma_chaine * mon_entier
@test(int, int)
def fn2(nb1, nb2):
return nb1 * nb2
or should I pass them as strings (eg @test('str', 'int)
) and inside test function use them with if
and elif
?