Changes between Version 50 and Version 51 of DeveloperGuidelines/Py_2_3
- Timestamp:
- 07/05/19 22:41:58 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/Py_2_3
v50 v51 178 178 if k in d: 179 179 }}} 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 182 In 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. 183 183 184 184 But where lists are required, the return value must be converted explicitly using the list constructor. … … 195 195 }}} 196 196 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. 199 198 === Don't unicode.encode === 200 199