summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/config.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-10-18 08:40:39 (GMT)
committerGitHub <noreply@github.com>2023-10-18 08:40:39 (GMT)
commit7c308f4c64dca4093b70b7a5e49f81c4f3679359 (patch)
tree80ab9d59668b1dbd46468f0b09494b9ef0906d76 /Lib/idlelib/config.py
parent50d936a125b17ff31b527347c0f4c37aa85efb83 (diff)
downloadcpython-7c308f4c64dca4093b70b7a5e49f81c4f3679359.zip
cpython-7c308f4c64dca4093b70b7a5e49f81c4f3679359.tar.gz
cpython-7c308f4c64dca4093b70b7a5e49f81c4f3679359.tar.bz2
[3.11] gh-103737: IDLE - Remove unneeded .keys() for dict iteration (GH-110960) (#111027)
gh-103737: IDLE - Remove unneeded .keys() for dict iteration (GH-110960) Add comments where .keys() is needed. Leave debugger usages along because situation is unclear as indicated in expanded comment. Most testing is manual. (cherry picked from commit baefbb21d91db2d950706737a6ebee9b2eff5c2d) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/config.py')
-rw-r--r--Lib/idlelib/config.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py
index 2b09d79..898efeb 100644
--- a/Lib/idlelib/config.py
+++ b/Lib/idlelib/config.py
@@ -597,7 +597,9 @@ class IdleConf:
problem getting any core binding there will be an 'ultimate last
resort fallback' to the CUA-ish bindings defined here.
"""
+ # TODO: = dict(sorted([(v-event, keys), ...]))?
keyBindings={
+ # vitual-event: list of key events.
'<<copy>>': ['<Control-c>', '<Control-C>'],
'<<cut>>': ['<Control-x>', '<Control-X>'],
'<<paste>>': ['<Control-v>', '<Control-V>'],
@@ -880,7 +882,7 @@ def _dump(): # htest # (not really, but ignore in coverage)
line, crc = 0, 0
def sprint(obj):
- global line, crc
+ nonlocal line, crc
txt = str(obj)
line += 1
crc = crc32(txt.encode(encoding='utf-8'), crc)
@@ -889,7 +891,7 @@ def _dump(): # htest # (not really, but ignore in coverage)
def dumpCfg(cfg):
print('\n', cfg, '\n') # Cfg has variable '0xnnnnnnnn' address.
- for key in sorted(cfg.keys()):
+ for key in sorted(cfg):
sections = cfg[key].sections()
sprint(key)
sprint(sections)
@@ -908,4 +910,6 @@ if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_config', verbosity=2, exit=False)
- # Run revised _dump() as htest?
+ _dump()
+ # Run revised _dump() (700+ lines) as htest? More sorting.
+ # Perhaps as window with tabs for textviews, making it config viewer.