(An advance apology for bothering about pygtk-0.6.x)
Today I was profiling some application data we have from our app and I
noticed that a *very* large amount of time is spent calling
GtkObject.__getattr__(). I just looked at the code and noticed that it
doesn't do anything special. Can I go ahead and kill it and __setattr__()
while I'm at it, or are there some hidden kabooms with this?
def __getattr__(self, attr):
# this function allows setting attributes on an object
# so that
# they will always be available with the object. Due to
# reference counting problems, we can't always pass the
# same GtkObject instance to a callback.
#if attr[0] == '_' or not self.__dict__.has_key('_o'):
# raise AttributeError, attr
#dict = self.get_data('Python-Attributes')
#if dict and dict.has_key(attr):
# return dict[attr]
raise AttributeError, attr
#def __setattr__(self, attr, value):
# if attr[0] == '_' or self.__dict__.has_key(attr) or \
# not self.__dict__.has_key('_o'):
# self.__dict__[attr] = value
# dict = self.get_data('Python-Attributes')
# if not dict:
# dict = {}
# self.set_data('Python-Attributes', dict)
# dict[attr] = value
#def __delattr__(self, attr):
# if self.__dict__.has_key(attr):
# del self.__dict__[attr]
# return
# if not self.__dict__.has_key('_o'):
# raise AttributeError, \
# 'delete non-existing instance attribute'
# dict = self.get_data('Python-Attributes')
# if dict and dict.has_key(attr):
# del dict[attr]
# else:
# raise AttributeError, \
# 'delete non-existing instance attribute'
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/