On 07/19/2011 01:00 PM, Micah wrote:
That sounds artificially backwards; why not let getToken() reuse peekToken()?

def peek(self):
     if self.tok is None:
         try:
             self.tok = self.gen.next()
         except StopIteration:
             self.tok = NULL
     return self.tok

def pop(self):
     token = self.peek()
     self.tok = None
     return token

I actually like this way better, thanks!

--
Bill
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to