Functional Python Programming
The Multiprocessing and Threading Modules This function will produce a Counter() object that shows the frequency of each path in ...
Chapter 12 We've created a Pool object with four separate processes and assigned this Pool object to the workers variable. We've ...
The Multiprocessing and Threading Modules The map(function, iterable) method allocates items from the iterable to each worker in ...
Chapter 12 Using apply() to make a single request In addition to the map() function's variants, a pool also has an apply(functio ...
The Multiprocessing and Threading Modules The resulting Counter objects from the analysis() function are combined into a single ...
Chapter 12 Here is an example to show just how similar they are: import concurrent.futures pool_size= 4 pattern = "*.gz" combine ...
The Multiprocessing and Threading Modules Using the threading and queue modules The Python threading package involves a number o ...
Chapter 12 The lower-level parsing can be decomposed into four stages: Reading all the lines from multiple source logfiles. Thi ...
The Multiprocessing and Threading Modules In this case, however, we need to distribute the I/O processing to as many CPUs or cor ...
Conditional Expressions and the Operator Module Functional programming emphasizes lazy or non-strict ordering of operations. The ...
Conditional Expressions and the Operator Module The use of the lambda x,y: xy parameter seems a bit wordy for multiplication. Af ...
Chapter 13 We can use dictionary keys and the lambda objects to create a very complex set of conditions. Here's a way to express ...
Conditional Expressions and the Operator Module Filtering true conditional expressions We have a number of ways of determining w ...
Chapter 13 These match built-in functions in other functional programming languages. We don't really need to write these functio ...
Conditional Expressions and the Operator Module [YearCheese(year=2000, cheese=29.87), YearCheese(year=2001, cheese=30.12), YearC ...
Chapter 13 Here's a continuation of the preceding example of the itertools.starmap() function: p = (3, 8, 29, 44) pi = sum(st ...
Conditional Expressions and the Operator Module This is a series expansion based on 4 arctan(1)=π. The expansion is (^0) () 2! n ...
Chapter 13 Once we have a prod() function, this means that the factorial can be defined as follows: fact= lambda n: 1 if n < ...
...
The PyMonad Library A monad allows us to impose an order on expression evaluation in an otherwise lenient language. We can use a ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf