Links and renumbering
This commit is contained in:
@@ -101,7 +101,7 @@ You will notice that data incrementally flows through the different functions.
|
||||
For this exercise the `stocksim.py` program should still be running in the background.
|
||||
You’re going to use the `follow()` function you wrote in the previous exercise.
|
||||
|
||||
### (a) Setting up a simple pipeline
|
||||
### Exercise 6.8: Setting up a simple pipeline
|
||||
|
||||
Let's see the pipelining idea in action. Write the following
|
||||
function:
|
||||
@@ -132,7 +132,7 @@ to it as an argument. Now, try this:
|
||||
It might take awhile for output to appear, but eventually you
|
||||
should see some lines containing data for IBM.
|
||||
|
||||
### (b) Setting up a more complex pipeline
|
||||
### Exercise 6.9: Setting up a more complex pipeline
|
||||
|
||||
Take the pipelining idea a few steps further by performing
|
||||
more actions.
|
||||
@@ -156,7 +156,7 @@ Well, that's interesting. What you're seeing here is that the output of the
|
||||
`follow()` function has been piped into the `csv.reader()` function and we're
|
||||
now getting a sequence of split rows.
|
||||
|
||||
### (c) Making more pipeline components
|
||||
### Exercise 6.10: Making more pipeline components
|
||||
|
||||
Let's extend the whole idea into a larger pipeline. In a separate file `ticker.py`,
|
||||
start by creating a function that reads a CSV file as you did above:
|
||||
@@ -237,7 +237,7 @@ Run your program again. You should now a stream of dictionaries like this:
|
||||
...
|
||||
```
|
||||
|
||||
### (d) Filtering data
|
||||
### Exercise 6.11: Filtering data
|
||||
|
||||
Write a function that filters data. For example:
|
||||
|
||||
@@ -262,7 +262,7 @@ for row in rows:
|
||||
print(row)
|
||||
```
|
||||
|
||||
### (e) Putting it all together
|
||||
### Exercise 6.12: Putting it all together
|
||||
|
||||
In the `ticker.py` program, write a function `ticker(portfile, logfile, fmt)`
|
||||
that creates a real-time stock ticker from a given portfolio, logfile,
|
||||
@@ -296,6 +296,6 @@ pipelines. In addition, you can create functions that package a
|
||||
series of pipeline stages into a single function call (for example,
|
||||
the `parse_stock_data()` function).
|
||||
|
||||
[Next](04_More_generators)
|
||||
[Contents](../Contents) \| [Previous (6.2 Customizing Iteration)](02_Customizing_iteration) \| [Next (6.4 Generator Expressions)](04_More_generators)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user