python-CSD-kursu/python-temel/sinif.nesnesi.yaratilmasi.py

15 lines
274 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class foo:
def __init__(self, f):
print('ilk işlemler')
self.f = f
def __call__(self):
print('araya giren işlemler')
self.f()
@foo
def bar():
print('bar')
bar() # aslında bar.__call__() çağrısı yapılıyor