Refactor __iternext__ functionality into readline() method