Tim wrote:
I have this type of situation and wonder if I should use a global variable
outside the recursive function instead of passing the updated parameter
through.

No! Globals are evil, at least for that sort of thing.
The way you're doing it is fine.

The only thing I would change is to wrap it all up
in a top-level function that takes care of creating
the result set and returning it.

def walk(obj):
  res = set()
  _walk(obj, res)
  return res

def _walk(obj, res):
  ...

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to