[Python-checkins] r47193 - sandbox/trunk/Doc/functional.rst
andrew.kuchling
python-checkins at python.org
Sat Jul 1 19:44:21 CEST 2006
Author: andrew.kuchling
Date: Sat Jul 1 19:44:20 2006
New Revision: 47193
Modified:
sandbox/trunk/Doc/functional.rst
Log:
More typo fixes and a few edits
Modified: sandbox/trunk/Doc/functional.rst
==============================================================================
--- sandbox/trunk/Doc/functional.rst (original)
+++ sandbox/trunk/Doc/functional.rst Sat Jul 1 19:44:20 2006
@@ -838,8 +838,8 @@
def adder(x,y):
return x + y
-Which alternative is preferable? That's a style question; my general
-view is to avoid it.
+Which alternative is preferable? That's a style question; my usual
+view is to avoid using ``lambda``.
``lambda`` is quite limited in the functions it can define. The
result has to be computable as a single expression, which means you
@@ -852,16 +852,16 @@
freq = reduce(lambda a, b: (0, a[1] + b[1]), items)[1]
-You can figure it out, but it takes time to disentangle the function
+You can figure it out, but it takes time to disentangle the expression
to figure out what's going on. Using a short nested
``def`` statements makes things a little bit better::
def combine (a, b):
return 0, a[1] + b[1]
- return reduce(combine_freq, items)[1]
+ return reduce(combine, items)[1]
-It would be best of all if I had simply used a ``for`` loop::
+But it would be best of all if I had simply used a ``for`` loop::
total = 0
for a, b in items:
@@ -877,7 +877,7 @@
4) Convert the lambda to a def statement, using that name.
5) Remove the comment.
-I really like these rules, but you're free todisagree that this style
+I really like these rules, but you're free to disagree that this style
is better.
@@ -1133,7 +1133,7 @@
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
-article: Ian Bicking, Raymond Hettinger, Jim Jewett.
+article: Ian Bicking, Raymond Hettinger, Jim Jewett, Leandro Lameiro.
Version 0.1: posted June 30 2006.
More information about the Python-checkins
mailing list