On 6/7/07, Nathan Harmston <[EMAIL PROTECTED]> wrote: > Hi, > > I m trying to implement an object which contains lazy" variables. My > idea is to alter the getattr and the setattr methods. However I keep > on getting a recursion error.
Simplifying radically, you are doing: def __setattr__(self, attr, k): if attr == "var1": self.var1 = k The last line here sets the var1 attribute, and that goes through your __setattr__() method again; henct the recursion error. You need to bypass the __setattr__() method with something like: self.__dict__['var1'] = k -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ GTalk: simon.brunning | MSN: small_values | Yahoo: smallvalues -- http://mail.python.org/mailman/listinfo/python-list