- changed status to resolved
SAS7BDAT should not subclass Iterator
Issue #8
resolved
Currently
>>> issubclass(sas7bdat.SAS7BDAT, Iterator)
True
because this object implements __next__
. This is somewhat atypical because it means that the main object to represent persistent data also holds on to the state of iteration. There is now only one possible iterator (not several.) So, for example, repeated attempts to get the first five entries of a file through iteration will receive a different set of five entries.
Rather than defining __next__
explicitly it is much more common to just define __iter__
and have that method return an iterator like the result of calling readlines
.
So I suggest the following changes
- Delete the
__next__
method - redefine
__iter__
to returnself.readlines()
rather thanself
Comments (1)
-
repo owner - Log in to comment
Merged in mrocklin/sas7bdat (pull request #6)
Python 26 compatibility and Iterator fix Fixes
#8→ <<cset c07bcd3edfd0>>