use get instead of setdefault for kwargs.

This commit is contained in:
Todd Gamblin 2013-12-09 10:44:46 -08:00
parent 936f54761b
commit 8d51c95e68

View file

@ -397,10 +397,10 @@ def preorder_traversal(self, visited=None, d=0, **kwargs):
root [=True] root [=True]
If false, this won't yield the root node, just its descendents. If false, this won't yield the root node, just its descendents.
""" """
depth = kwargs.setdefault('depth', False) depth = kwargs.get('depth', False)
key_fun = kwargs.setdefault('key', id) key_fun = kwargs.get('key', id)
yield_root = kwargs.setdefault('root', True) yield_root = kwargs.get('root', True)
cover = kwargs.setdefault('cover', 'nodes') cover = kwargs.get('cover', 'nodes')
cover_values = ('nodes', 'edges', 'paths') cover_values = ('nodes', 'edges', 'paths')
if cover not in cover_values: if cover not in cover_values: