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]
If false, this won't yield the root node, just its descendents.
"""
depth = kwargs.setdefault('depth', False)
key_fun = kwargs.setdefault('key', id)
yield_root = kwargs.setdefault('root', True)
cover = kwargs.setdefault('cover', 'nodes')
depth = kwargs.get('depth', False)
key_fun = kwargs.get('key', id)
yield_root = kwargs.get('root', True)
cover = kwargs.get('cover', 'nodes')
cover_values = ('nodes', 'edges', 'paths')
if cover not in cover_values: