summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-22 00:21:25 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-22 00:21:25 (GMT)
commit89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c (patch)
treeaef767c70a3b57c4128d44816e4e070d28fffb9d /Lib/idlelib
parent6cefeb0e8156406ac3f99248f6a3d3cd1536ca23 (diff)
downloadcpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.zip
cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.tar.gz
cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.tar.bz2
Kill reduce(). A coproduction of John Reese, Jacques Frechet, and Alex M.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/AutoCompleteWindow.py6
-rw-r--r--Lib/idlelib/MultiCall.py22
2 files changed, 14 insertions, 14 deletions
diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py
index d8bbff4..8bed034 100644
--- a/Lib/idlelib/AutoCompleteWindow.py
+++ b/Lib/idlelib/AutoCompleteWindow.py
@@ -335,10 +335,8 @@ class AutoCompleteWindow:
self.userwantswindow = True
return
- elif reduce(lambda x, y: x or y,
- [keysym.find(s) != -1 for s in ("Shift", "Control", "Alt",
- "Meta", "Command", "Option")
- ]):
+ elif any(s in keysym for s in ("Shift", "Control", "Alt",
+ "Meta", "Command", "Option")):
# A modifier key, so ignore
return
diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py
index 4f53115..1c6103a 100644
--- a/Lib/idlelib/MultiCall.py
+++ b/Lib/idlelib/MultiCall.py
@@ -106,24 +106,26 @@ class _SimpleBinder:
# _state_subsets gives for each combination of modifiers, or *state*,
# a list of the states which are a subset of it. This list is ordered by the
# number of modifiers is the state - the most specific state comes first.
+# XXX rewrite without overusing functional primitives :-)
_states = range(1 << len(_modifiers))
-_state_names = [reduce(lambda x, y: x + y,
- [_modifiers[i][0]+'-' for i in range(len(_modifiers))
- if (1 << i) & s],
- "")
+_state_names = [''.join(m[0]+'-'
+ for i, m in enumerate(_modifiers)
+ if (1 << i) & s)
for s in _states]
_state_subsets = map(lambda i: filter(lambda j: not (j & (~i)), _states),
- _states)
+ _states)
for l in _state_subsets:
l.sort(lambda a, b, nummod = lambda x: len(filter(lambda i: (1<<i) & x,
range(len(_modifiers)))):
nummod(b) - nummod(a))
# _state_codes gives for each state, the portable code to be passed as mc_state
-_state_codes = [reduce(lambda x, y: x | y,
- [_modifier_masks[i] for i in range(len(_modifiers))
- if (1 << i) & s],
- 0)
- for s in _states]
+_state_codes = []
+for s in _states:
+ r = 0
+ for i in range(len(_modifiers)):
+ if (1 << i) & s:
+ r |= _modifier_masks[i]
+ _state_codes.append(r)
class _ComplexBinder:
# This class binds many functions, and only unbinds them when it is deleted.