summaryrefslogtreecommitdiff
path: root/Misc/cheatsheet
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-26 20:49:04 +0000
committerGuido van Rossum <guido@python.org>2006-08-26 20:49:04 +0000
commita3bd4b68f5b3c14f9b292963a9845ba2a789d4c8 (patch)
tree2b9d5760f2dffeb5a5a3ff5c23d753574be2e8db /Misc/cheatsheet
parentc0719f329f62fd4ac96de65b07d1ed20e78b0d24 (diff)
downloadcpython-a3bd4b68f5b3c14f9b292963a9845ba2a789d4c8.tar.gz
Part of SF patch #1513870 (the still relevant part) -- add reduce() to
functools, and adjust docs etc.
Diffstat (limited to 'Misc/cheatsheet')
-rw-r--r--Misc/cheatsheet7
1 files changed, 1 insertions, 6 deletions
diff --git a/Misc/cheatsheet b/Misc/cheatsheet
index 65b1400e6b..bab109a8ab 100644
--- a/Misc/cheatsheet
+++ b/Misc/cheatsheet
@@ -901,7 +901,7 @@ lambda [param_list]: returnedExpr
-- Creates an anonymous function. returnedExpr must be
an expression, not a statement (e.g., not "if xx:...",
"print xxx", etc.) and thus can't contain newlines.
- Used mostly for filter(), map(), reduce() functions, and GUI callbacks..
+ Used mostly for filter(), map() functions, and GUI callbacks..
List comprehensions
result = [expression for item1 in sequence1 [if condition1]
[for item2 in sequence2 ... for itemN in sequenceN]
@@ -1005,11 +1005,6 @@ property() Created a property with access controlled by functions.
range(start [,end Returns list of ints from >= start and < end.With 1 arg,
[, step]]) list from 0..arg-1With 2 args, list from start..end-1With 3
args, list from start up to end by step
-reduce(f, list [, Applies the binary function f to the items oflist so as to
-init]) reduce the list to a single value.If init given, it is
- "prepended" to list.
- Re-parses and re-initializes an already imported module.
- Useful in interactive mode, if you want to reload amodule
reload(module) after fixing it. If module was syntacticallycorrect but had
an error in initialization, mustimport it one more time
before calling reload().