Re: pushback iterator

2009-05-22 Thread Simon Forman
On May 17, 10:39 am, Matus wrote: > Hallo pylist, > > I searches web and python documentation for implementation of pushback > iterator but found none in stdlib. > > problem: > > when you parse a file, often you have to read a line from parsed file > before you can decide if you want that

Re: pushback iterator

2009-05-17 Thread Matus
Luis Alberto Zarrabeitia Gomez wrote: > Quoting Mike Kazantsev : > >> And if you're "pushing back" the data for later use you might just as >> well push it to dict with the right indexing, so the next "pop" won't >> have to roam thru all the values again but instantly get the right one >> from t

Re: pushback iterator

2009-05-17 Thread Luis Alberto Zarrabeitia Gomez
Quoting Mike Kazantsev : > And if you're "pushing back" the data for later use you might just as > well push it to dict with the right indexing, so the next "pop" won't > have to roam thru all the values again but instantly get the right one > from the cache, or just get on with that iterable unt

Re: pushback iterator

2009-05-17 Thread Mike Kazantsev
Somehow, I got the message off the list. On Sun, 17 May 2009 17:42:43 +0200 Matus wrote: > > Sounds to me more like an iterator with a cache - you can't really pull > > the line from a real iterable like generator function and then just push > > it back. > > true, that is why you have to implem

Re: pushback iterator

2009-05-17 Thread Mike Kazantsev
On Sun, 17 May 2009 16:39:38 +0200 Matus wrote: > I searches web and python documentation for implementation of pushback > iterator but found none in stdlib. > > problem: > > when you parse a file, often you have to read a line from parsed file > before you can decide if you want that l