That's what 'self' is for ;). Also prefix 'crlf_re' with an
underscore to mark it as private data, and not part of
LineBufferedStream's API.
class LineBufferedStream():
"Line-buffer a read stream."
- crlf_re = re.compile(b'\r?\n')
+ _crlf_re = re.compile(b'\r?\n')
def __init__(self):
self.buffer = ''
def lines(self):
"Iterate over lines in the buffer."
- lines = LineBufferedStream.crlf_re.split(self.buffer)
+ lines = self._crlf_re.split(self.buffer)
self.buffer = lines.pop()
return iter(lines)