diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-01 22:26:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-01 22:26:00 (GMT) |
commit | ac60d1afd2b04f61fe4c965740fa32809f2b84ed (patch) | |
tree | 7c3d6c0e7baf541d4572c357bf816387dfa214b8 /Lib/idlelib/browser.py | |
parent | fefdc009906c5ea8fb57383817b3c42d3b0634ad (diff) | |
download | cpython-ac60d1afd2b04f61fe4c965740fa32809f2b84ed.zip cpython-ac60d1afd2b04f61fe4c965740fa32809f2b84ed.tar.gz cpython-ac60d1afd2b04f61fe4c965740fa32809f2b84ed.tar.bz2 |
bpo-32411: IDLE: Remove line number sort in browser.py (GH-5011)
Insertion in line order makes sorting keys by line order unneeded.
(cherry picked from commit 1a4d9ffa1aecd7e750195f2be06d3d16c7a3a88f)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Diffstat (limited to 'Lib/idlelib/browser.py')
-rw-r--r-- | Lib/idlelib/browser.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py index 234883f..e5b0bc5 100644 --- a/Lib/idlelib/browser.py +++ b/Lib/idlelib/browser.py @@ -29,9 +29,10 @@ def transform_children(child_dict, modname=None): The dictionary maps names to pyclbr information objects. Filter out imported objects. Augment class names with bases. - Sort objects by line number. + The insertion order of the dictonary is assumed to have been in line + number order, so sorting is not necessary. - The current tree only calls this once per child_dic as it saves + The current tree only calls this once per child_dict as it saves TreeItems once created. A future tree and tests might violate this, so a check prevents multiple in-place augmentations. """ @@ -51,7 +52,7 @@ def transform_children(child_dict, modname=None): supers.append(sname) obj.name += '({})'.format(', '.join(supers)) obs.append(obj) - return sorted(obs, key=lambda o: o.lineno) + return obs class ModuleBrowser: |