Why does wsgiref have such redundant statements?

60 views Asked by At

When I read the source code of wsgiref (version 0.1), the class SimpleHandler which contained two functions _write and _flush confused me. I think self._write = self.stdout.write and self._flush = self.stdout.flush are redundant. When I commented it out, it seems to still work. So why is it written like this?

def _write(self,data):
    self.stdout.write(data)
    self._write = self.stdout.write

def _flush(self):
    self.stdout.flush()
    self._flush = self.stdout.flush
0

There are 0 answers