
On Sun, Dec 15, 2019 at 11:45 AM David Mertz <mertz@gnosis.cx> wrote:
Hmm, interesting -- so this means that you do write code expecting a
generic iterator, rather than a file-like object.
How file-like do you need? I've certainly written things that usually take an actual file, but sometimes get io.StringIO, or an SQL cursor.
file-like enough to have a .readline() method. which I expect an SQL cursor does not (or does it?) It all depends on what interface a given object is emulating -- I've always thought in terms of file-like objects, but maybe iterator_of_lines is more generic. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython