Return and set
Billy Mays
81282ed9a88799d21e77957df2d84bd6514d9af6 at myhashismyemail.com
Tue Jul 19 13:19:31 EDT 2011
On 07/19/2011 01:02 PM, Terry Reedy wrote:
> You did not answer Ben's question about the allowed values of self.tok
> and whether you really want to clobber all 'false' values. The proper
> code depends on that answer.
>
>> NULL is an enumerated value I have defined above. The idea is for
>> peekToken to reuse getToken, but to keep the token still around.
>
> I think about reversing and have getToken use peekToken and then reset.
> But that depends on the exact logic which depends on the specs. I would
> more likely have just one function with a reset parameter defaulted to
> the more common value.
>
self.gen is a generator that gets filters single characters from a file.
Values that come from self.gen.next() will always be string values
since the file generator closes on EOF. I can be sure that I will
either get a string from self.gen.next() or catch an exception so its
okay to use NULL (which evaluates to 0).
You are correct it makes more sense to use peekToken() to do the lifting
and getToken() to reuse the token. However, I am not sure what you mean
by reset.
--
Bill
More information about the Python-list
mailing list