changeset 67:2253177294ab draft

State: Fill buffer before advancing in next()
author Lewin Bormann <lbo@spheniscida.de>
date Sat, 25 May 2019 14:49:45 +0200
parents b9ed614fc42f
children f02036f75ecf
files pcombinators/state.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pcombinators/state.py	Sat May 25 14:46:01 2019 +0200
+++ b/pcombinators/state.py	Sat May 25 14:49:45 2019 +0200
@@ -150,9 +150,9 @@
         return self._buf[self._index]
 
     def next(self):
+        self.fill_buffer()
         if self.finished():
             return None
-        self.fill_buffer()
         self._index += 1
         return self._buf[self._index-1]