[New-bugs-announce] [issue32411] Idlelib.browser: stop sorting dicts created by pyclbr

Terry J. Reedy report at bugs.python.org
Fri Dec 22 21:41:09 EST 2017


New submission from Terry J. Reedy <tjreedy at udel.edu>:

pyclbr does a linear scan of a file and returns a dict, and Class objects have a dict of children. For objects in the file being scanned, insertion order is the same as line number order.  idlelib.browser.transform children filters out objects not in the file, changes the .name of some objects in the file, appends to a list, and sorts by line number.  (I should have done the sort in place.)  For insertion order dicts, the sort does nothing. In 3.7, insertion order is a language guarantee, not just a (current) CPython implementation detail.  The sort does not change the order and is therefore no longer needed. We can reduce
    return sorted(obs, key=lambda o: o.lineno)
to
    return obs

However, I do want to make sure that there is at least one test that will break if there is a bug somewhere.

----------
assignee: terry.reedy
components: IDLE
messages: 308945
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Idlelib.browser: stop sorting dicts created by pyclbr
type: performance
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32411>
_______________________________________


More information about the New-bugs-announce mailing list