New submission from Terry J. Reedy <tjre...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue32411>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to