summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/python-best-practices.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/content/python-best-practices.rst b/content/python-best-practices.rst
index 167f5ab..1457f9f 100644
--- a/content/python-best-practices.rst
+++ b/content/python-best-practices.rst
@@ -75,7 +75,7 @@ comprehensions* (very original, isn't it?). For example, to transform a list of
.. code-block:: python
- l = [("Barthes", "+33 6 29 64 91 12"), ("Dumbo", "+001 650 472 4243")]
+ l = [("Barthes", "+33 6 29 64 91 12"), ("John", "+001 650 472 4243")]
d = {name: phone for (name, phone) in l}
You can get more details about *list comprehensions* on the `dedicated section <http://docs.python.org/tutorial/datastructures.html#list-comprehensions>`__ of the official documentation.
@@ -168,12 +168,12 @@ regard:
.. code-block:: python
- l = ["Dumbo", "Polochon"]
+ l = ["Adam", "Eve"]
def reverse(word):
return word[::-1]
- m = map(reverse, l) # m = ['obmuD', 'nohcoloP']
+ m = map(reverse, l) # m = ['madA', 'evE']
*slices* are also very useful when it comes to manipulating lists (or sublists)
in blocks. Remember that if ``l`` is a list (or any iterable)