diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-09-10 10:28:42 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-09-10 10:28:42 -0400 |
commit | ad28e228e30b50183935db09364c95dbe663a087 (patch) | |
tree | 5320eef46ffe0732669a99bb9d6026ef0970151f | |
parent | 03797b78475bec9fb9c15f8e926414f3720a273c (diff) | |
download | sqlalchemy-ad28e228e30b50183935db09364c95dbe663a087.tar.gz |
- call it deque, since you can really pop from either side
-rw-r--r-- | doc/build/faq/sessions.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/build/faq/sessions.rst b/doc/build/faq/sessions.rst index a89b3765c..2e4bdd4c8 100644 --- a/doc/build/faq/sessions.rst +++ b/doc/build/faq/sessions.rst @@ -430,12 +430,12 @@ iterate all the objects, correcting for cycles as well:: def walk(obj): - stack = [obj] + deque = [obj] seen = set() - while stack: - obj = stack.pop(0) + while deque: + obj = deque.pop(0) if obj in seen: continue else: @@ -445,9 +445,9 @@ iterate all the objects, correcting for cycles as well:: for relationship in insp.mapper.relationships: related = getattr(obj, relationship.key) if relationship.uselist: - stack.extend(related) + deque.extend(related) elif related is not None: - stack.append(related) + deque.append(related) The function can be demonstrated as follows:: |