ungetc in python

Bengt Richter bokr at oz.net
Fri Jan 31 17:28:34 EST 2003


On Fri, 31 Jan 2003 05:15:59 -0800, Erik Max Francis <max at alcyone.com> wrote:

>Scott Fenton wrote:
>
>> Hello. I was wondering if anyone knew if there was
>> an equivilant of ungetc in Python. I Googled for it
>> and didn't find anything, and I need it for a parser
>> I'm working on.
>
>Not natively, though it would be quite straightforward to write your own
>wrapper around a file object that implemented a pushback ability.
>
It just occurred to me that that might be a useful
generalized capability for iterators -- and not necessarily
limited to a single item of pushback.

Regards,
Bengt Richter




More information about the Python-list mailing list