diff --git a/python-temel/sinifin.metotlarina.dekorator.py b/python-temel/sinifin.metotlarina.dekorator.py new file mode 100644 index 0000000..092cc28 --- /dev/null +++ b/python-temel/sinifin.metotlarina.dekorator.py @@ -0,0 +1,18 @@ +def bar(f): + def g(*args, **kwargs): + print('araya girilen kod') + f(*args, **kwargs) + + return g + +class Sample: + def __init__(self, a): + self.a = a + + @bar + def foo(self): + print(self.a) + # foo = bar(foo) + +s = Sample(10) +s.foo # Sample.foo(s, 10)