summaryrefslogtreecommitdiffstats
path: root/Misc/cheatsheet
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-26 20:49:04 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-26 20:49:04 (GMT)
commit0919a1a07b061ef9a8a94cc1d92c1895b00967cb (patch)
tree812681b0b579aa36b1117b192c016b7f90ada6b0 /Misc/cheatsheet
parent6a2a2a08329567ea41f4f073cb43e487f83872c7 (diff)
downloadcpython-0919a1a07b061ef9a8a94cc1d92c1895b00967cb.zip
cpython-0919a1a07b061ef9a8a94cc1d92c1895b00967cb.tar.gz
cpython-0919a1a07b061ef9a8a94cc1d92c1895b00967cb.tar.bz2
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 65b1400..bab109a 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().