title: Persistent objects in recursive python functions
body: <p>I am trying to write a recursive function that needs to store and modify an object (say a set) as it recurses. Should I use a global name inside the function? Another option is  to modify or inherit the class of the parameter of the function so that it can keep this persistent object but I don't find it elegant. I could also use a stack if I would forgo the recursion altogether... </p>
  
  <p>Is there a pythonic way of doing this? Could a generator do the trick? </p>