Functional Python Programming

(Wang) #1

generator expressions, applying to scalar
functions 72 , 73
items, picking up from sequence 65 - 67
iter() function, using 67 , 68
len() fucntion, using 75
simple loop, extending 68 - 71
sum() function, using 75
sums, using for statistics 76 - 78
working with 60 , 61
XML file, parsing 61 - 63
iter_except function 179
iter() function
about 99
using 99
itertools functions
combinations() 181
combinations_with_replacement() 181
permutations() 181
product() 181
itertools module
about 160
all combinations, generating 191 - 194
Cartesian product, enumerating 182
finite iterators 165
iterator functions 159
itertools recipes 178 , 194
itertools.starmap() function 258
itertools.zip_longest() function 258


J


Jinja2 templates 287
JSON serializer 298


L


lambda calculus 93
lambda forms
working with 94
lazy List() functor
using 271 - 274
lists
about 50
using 50 - 53
local_gzip() function 235


lru_cache decorator
about 198
used, for caching previous results 198 - 200
LRU (Least Recently Used) 198

M
map() function
about 93
used, for applying function to data 176 , 177
using 93 , 94
using, with multiple sequence 95 , 96
working with 94
map(function, iterable) method 246
mapping
building, by sorting 128 , 129
building, with Counter 127 , 128
creating, bisect module used 55 , 56
max() function
using 88 - 91
mean() function 98
memoization
about 305
specializing 307 , 308
min() function
using 88 - 91
monad 274
monoid 279
multiprocessing module
about 229 , 230
access details, analyzing 243 , 244
access details, filtering 241 - 243
Access object fields, parsing 238 - 241
boundary conditions 231
complete analysis process 244
large files, processing 234 , 235
log files, parsing 235 , 236
log lines, parsing into namedtuples 236 - 238
resources, sharing with process 231 , 232
resources, sharing with threading 231 , 232
using 233 , 234
multiprocessing pool, for concurrent
processing
apply_async() function, using 247
apply(), used for making single request 247
Free download pdf