> How about: > > def get_prior_versions (item_id, priors=None): > """Return a list of all prior item ids starting with this one""" > global history_db # key = item id, value = prior item id > prior_id = history_db[item_id] > if not prior_id: > return priors > else: > if priors: > priors.append(prior_id) > else: > priors = [prior_id] > return get_prior_versions(prior_id, priors)
It's not exactly right for what I'm doing, b/c the caller always expects a list in return. -- http://mail.python.org/mailman/listinfo/python-list