From 530cd2952ea5e5ae5b231d7ee63b3f1528c30814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Sat, 5 Aug 2023 16:36:34 +0300 Subject: [PATCH] =?UTF-8?q?S=C4=B1n=C4=B1f=20Nesnesinin=20Yarat=C4=B1lmas?= =?UTF-8?q?=C4=B1=20=C3=B6rne=C4=9Fi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python-temel/sinif.nesnesi.yaratilmasi.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 python-temel/sinif.nesnesi.yaratilmasi.py diff --git a/python-temel/sinif.nesnesi.yaratilmasi.py b/python-temel/sinif.nesnesi.yaratilmasi.py new file mode 100644 index 0000000..7178557 --- /dev/null +++ b/python-temel/sinif.nesnesi.yaratilmasi.py @@ -0,0 +1,14 @@ +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