I bumped into the following last night and I'm still at a loss as to explain it:
class Foo(object):
@property
def dave(self):
vars(self)['dave'] = 1
return 2
f = Foo()
print f.dave
print f.dave
Running this code produces:
2
2
The question is why? My understanding of attribute access is that the instance dictionary is checked before the class dictionary, and the dictionary of any bases, however as seen above the instance dictionary doesn't appear to be getting checked before the descriptor is found in the class dictionary.