diff options
Diffstat (limited to 'Lib/pydoc.py')
| -rwxr-xr-x[-rw-r--r--] | Lib/pydoc.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 5e5a8ae..a9c04f0 100644..100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -209,18 +209,6 @@ def classify_class_attrs(object): results.append((name, kind, cls, value)) return results -def sort_attributes(attrs, object): - 'Sort the attrs list in-place by _fields and then alphabetically by name' - # This allows data descriptors to be ordered according - # to a _fields attribute if present. - fields = getattr(object, '_fields', []) - try: - field_order = {name : i-len(fields) for (i, name) in enumerate(fields)} - except TypeError: - field_order = {} - keyfunc = lambda attr: (field_order.get(attr[0], 0), attr[0]) - attrs.sort(key=keyfunc) - # ----------------------------------------------------- module manipulation def ispackage(path): @@ -879,7 +867,8 @@ class HTMLDoc(Doc): object.__module__) tag += ':<br>\n' - sort_attributes(attrs, object) + # Sort attrs by name. + attrs.sort(key=lambda t: t[0]) # Pump out the attrs, segregated by kind. attrs = spill('Methods %s' % tag, attrs, @@ -1297,8 +1286,8 @@ location listed above. else: tag = "inherited from %s" % classname(thisclass, object.__module__) - - sort_attributes(attrs, object) + # Sort attrs by name. + attrs.sort() # Pump out the attrs, segregated by kind. attrs = spill("Methods %s:\n" % tag, attrs, @@ -1911,10 +1900,10 @@ has the same effect as typing a particular string at the help> prompt. def intro(self): self.output.write(''' -Welcome to Python {0}'s help utility! +Welcome to Python %s's help utility! If this is your first time using Python, you should definitely check out -the tutorial on the Internet at http://docs.python.org/{0}/tutorial/. +the tutorial on the Internet at http://docs.python.org/%s/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and @@ -1924,7 +1913,7 @@ To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". -'''.format('%d.%d' % sys.version_info[:2])) +''' % tuple([sys.version[:3]]*2)) def list(self, items, columns=4, width=80): items = list(sorted(items)) |
