I have been reading a tutorial book for python and it briefly discussed properties. From what I understand, when a class attribute is requested, python directs the request to the property method that returns the attribute so that code can be run before the attribute is accessed. But why is this necessary, when in the example below, the attribute v being returned cannot even be accessed with dot notation?
@property
def value(self):
if self.is_face_up:
v = BJ_Card.RANKS.index(self.rank) + 1
if v > 10:
v = 10
else:
v = None
return v