diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2013-02-24 21:21:37 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2013-02-24 21:21:37 +0100 |
| commit | b3f04bc23e4c69f85ac00ecbb61d71230c1464cd (patch) | |
| tree | cb5d449b6e7268008b51258a7afea09421b22f15 /content/python-best-practices.rst | |
| parent | 8e142f75e210b51b929ee179f7de1d9b599a146a (diff) | |
| download | blog-b3f04bc23e4c69f85ac00ecbb61d71230c1464cd.tar.gz | |
Typo fix
Diffstat (limited to 'content/python-best-practices.rst')
| -rw-r--r-- | content/python-best-practices.rst | 6 |
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) |
