From 7d22bf4461d3b635dd59ca0ed3cbd6cbcd11201e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Thu, 28 Jul 2005 23:59:24 +0000 Subject: [PATCH] =?UTF-8?q?bir=20nesnenin=20t=C3=BCm=20de=C4=9Fi=C5=9Fkenl?= =?UTF-8?q?erini=20yazd=C4=B1r=C4=B1yor.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __str__() ile ilgili soruma cevap verirseniz ilgili sınıflar içerisinde bunu şöyle kullanacağız: def __str__(self): util.print_object_members(self) --- pisi/util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pisi/util.py b/pisi/util.py index 7006aeda..9e0ab170 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -24,6 +24,17 @@ class FileError(Exception): class UtilError(Exception): pass +################################# +# # Helpers for O-O programming # +################################# + +def print_object_members(obj): + "prints the __dict__ of an object" + ui.debug("--- %s ---\n" %obj.__class__) + d = obj.__dict__ + for member in d.keys(): + ui.debug("\t%s: %s\n" % (member, d[member])) + ######################### # string/list functions #