From 89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 22 Aug 2006 00:21:25 +0000 Subject: Kill reduce(). A coproduction of John Reese, Jacques Frechet, and Alex M. --- Lib/idlelib/MultiCall.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Lib/idlelib/MultiCall.py') diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py index 4f5311586f..1c6103ad64 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<