Allen Fowler wrote: > > > */Eric Brunson <[EMAIL PROTECTED]>/* wrote: > > Allen Fowler wrote: > > I seem to be having an issue with __getattr__() being called > even if > > the proporite already exists... I thought that this was not > supposed > > to happen. > > I think you've misunderstood. __getattr__() should always be > called, it > allows you to intercept and reimplement the behavior of a attribute > lookup to suit your needs. Typically, my __getattrs__() look like > this: > > > > See: > http://docs.python.org/ref/attribute-access.html > > > This would lead me to think not that way... > > > "Note that if the attribute is found through the normal mechanism, > __getattr__() is not called. (This is an intentional asymmetry between > __getattr__() and __setattr__().) This is done both for efficiency > reasons and because otherwise __setattr__() would have no way to > access other attributes of the instance."
There you go, you are right and I am not. I guess because I don't actually set the attribute of self, I can intercept both the get and set. "Learn one new thing every day". Done. :-) > > > > ------------------------------------------------------------------------ > Building a website is a piece of cake. > Yahoo! Small Business gives you all the tools to get online. > <http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhosting/?p=PASSPORTPLUS> > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor