I am learning python, For sure a stupid question but I cannot find any answer.
I have an object
class ant(object):
def __init__(self, age):
self.age = 0
def update_age(self)
self.age += 1
pebbles = myant(25)
#check age
print pebbles.age
Now what I want to do is that every time someone checks pebble.age, pebbles automatically runs update_age() internally. Is it possible to do it? or every time I have to check pebbles_age I have to write:
pebbles.update_age()
print pebbles.age.
Thanks a lot