Gabriel Genellina a écrit : > En Wed, 14 Mar 2007 10:01:54 -0300, Joel Andres Granados > <[EMAIL PROTECTED]> escribió: > >> Bruno Desthuilliers wrote: >>> Joel Andres Granados a écrit : > >>>> I'm >>>> working with code that is not of my authorship and there is a class >>>> attribute that is changes by directly referencing it (object.attr = >>>> value) instead of using a getter/setter (object.setAttr(Value) ) > >>> yes : object.__setattr__(self, name, value) >> I used this ^^^^^^^^^^^^^^^ one. Thank for the help. > > The problem with __setattr__ is that it slows down significantly *all* > attributes. > Yours is the typical case when it's good to switch from using simple > attributes to using properties.
If this has to become a feature of the class, yes, indeed. If it's just a temporary hack for debugging, the using the __getattr__ hook is quicker and less intrusive. -- http://mail.python.org/mailman/listinfo/python-list