Compute Once Then Cache

About this trick:

def compute():

# ...

data = compute()

I think I succeeded in applying this. But, Where/How can I check that the socalled 'data' variable is imported/computed only once ?

P-Y Delens