Version 2 (modified by zooko, 15 years ago) (diff) |
---|
StringChain
Sometimes you want to accumulate data from some source while at the same time processing the data that arrived first. The naive way to do it in Python is like this:
def __init__(self): self.accum = '' # Will hold all unprocessed bytes def add_data(self, some_more_data): # some_more_data is a string self.accum += some_more_data def process_some(self, how_much): some = self.accum[:how_much] del self.accum[:how_much]
Starting Points
- TracGuide -- Built-in Documentation
- The Trac project -- Trac Open Source Project
- Trac FAQ -- Frequently Asked Questions
- TracSupport -- Trac Support
For a complete list of local wiki pages, see TitleIndex.