| 91 | Often, streams cannot be reused: in the above example, the sub-stream is based on a generator. Once it has been serialized, it will have been fully consumed, and cannot be rendered again. To work around this, you can wrap such a “read-once” stream in a `list`: |
| 92 | |
| 93 | {{{ |
| 94 | >>> from markup import Stream |
| 95 | >>> substream = Stream(list(stream.select('a'))) |
| 96 | >>> substream |
| 97 | <markup.core.Stream object at 0x7118b0> |
| 98 | >>> print substream |
| 99 | <a href="http://example.org/">a link</a> |
| 100 | >>> print substream.select('@href') |
| 101 | http://example.org/ |
| 102 | >>> print substream.select('text()') |
| 103 | a link |
| 104 | }}} |
| 105 | |