Changes between Version 50 and Version 51 of DeveloperGuidelines/Py_2_3


Ignore:
Timestamp:
07/05/19 22:41:58 (6 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Py_2_3

    v50 v51  
    178178if k in d:
    179179}}}
    180 === Map and Zip return generators ===
    181 
    182 In Python-3, the {{{map()}}} and {{{zip()}}} functions return generator objects rather than lists. This is fine when we want to iterate over the result, especially when there is a chance to break out of the loop early.
     180=== Map, Filter and Zip return generators ===
     181
     182In Python-3, the {{{map()}}}, {{{filter}}} and {{{zip()}}} functions return generator objects rather than lists. This is fine when we want to iterate over the result, especially when there is a chance to break out of the loop early.
    183183
    184184But where lists are required, the return value must be converted explicitly using the list constructor.
     
    195195}}}
    196196
    197 '''NB''' For building a list from a single iterable argument, we prefer list comprehensions over {{{map()}}} for readability and speed.
    198 
     197'''NB''' For building a list from a single iterable argument, we prefer list comprehensions over {{{map()}}} or {{{filter()}}} for readability and speed.
    199198=== Don't unicode.encode ===
    200199