On Thursday 18 July 2002 01:32 am, Greg Ewing wrote: > Alex Martelli <aleax@aleax.it>: > > All files have seek and write, but not on all files do they work -- and > > the same goes for iteration. I.e., it IS something of a mess > > I've just had a thought. Maybe it would be less of a mess > if what we are calling "iterators" had been called "streams" Possibly -- I did use the "streams" name often in the tutorial on iterators and generators, it's a very natural term. > instead. Then the term "iterator" could have been reserved > for the special case of an object that provides stream > access to a random-access collection. Nice touch, except that I keep quibbling on the "random access" need -- see my previous msg about sets. > Then you could say that a file object is a stream object That's what I'd love to do -- and requires the file object to expose a next method and have iter(f) is f. That's what Oren's patch does, and the reason I'm trying to save it from the need for a reference loop. > that provides line-by-line access to an OS file. Other > stream objects can be constructed that give access to > the OS file in other units. That would all make sense > without seeming to imply any multi-pass ability. Seekable files can be multi-pass, but in the strict sense that you can rewind them -- it's still impractical to have them produce multiple *independent* iterators (needing some sort of in-memory caching). Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4