Playing around with meta/dynamic programming in Python