cache code is more 'pythonic'