From 756b3f3c15bd314ffa25299ca25465ae21e62a30 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 29 Jan 2004 06:37:52 +0000 Subject: * Move collections.deque() in from the sandbox * Add unittests, newsitem, and whatsnew * Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py * Docs are forthcoming --- Lib/pydoc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Lib/pydoc.py') diff --git a/Lib/pydoc.py b/Lib/pydoc.py index e53aa1611c3..e6b53c19cd4 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -55,6 +55,7 @@ Mynd you, m import sys, imp, os, re, types, inspect, __builtin__ from repr import Repr from string import expandtabs, find, join, lower, split, strip, rfind, rstrip +from collections import deque # --------------------------------------------------------- common routines @@ -685,7 +686,7 @@ class HTMLDoc(Doc): hr = HorizontalRule() # List the mro, if non-trivial. - mro = list(inspect.getmro(object)) + mro = deque(inspect.getmro(object)) if len(mro) > 2: hr.maybe() push('
Method resolution order:
\n') @@ -763,7 +764,7 @@ class HTMLDoc(Doc): while attrs: if mro: - thisclass = mro.pop(0) + thisclass = mro.popleft() else: thisclass = attrs[0][2] attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) @@ -1083,7 +1084,7 @@ class TextDoc(Doc): push = contents.append # List the mro, if non-trivial. - mro = list(inspect.getmro(object)) + mro = deque(inspect.getmro(object)) if len(mro) > 2: push("Method resolution order:") for base in mro: @@ -1152,7 +1153,7 @@ class TextDoc(Doc): inspect.classify_class_attrs(object)) while attrs: if mro: - thisclass = mro.pop(0) + thisclass = mro.popleft() else: thisclass = attrs[0][2] attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) -- cgit v1.2.3