def garbagecollect(func):
 def inner(*args, **kwargs):
  result = func(*args, **kwargs)
  gc.collect()
  return result
 return inner

def garbagecollect ( func ) : def inner ( * args , ** kwargs ) : result = func ( * args , ** kwargs ) gc . collect ( ) return result return inner
decorate a function to invoke the garbage collector after each execution .