2

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
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
mutex86
  • 59
  • 6
  • 2
    If I had to guess, so you can override the methods from a subclass. If you want to be sure, you might want to contact a dev directly. – dav1d Aug 10 '15 at 11:54

0 Answers0