Sverker Nilsson wrote:
Sverker Nilsson wrote:
It reads one Stat object at a time and wants to report something
when there is no more to be read from the file.
Hmm, am I right in thinking the above can more nicely be written as:

 >>> from guppy import hpy
 >>> h = hpy()
 >>> f = open(r'your.hpy')
 >>> sets = []
 >>> for s in iter(h.load(f)): sets.append(s)
...

The above iterates over one Stat object returned by h.load(f). I assume
you want to iterate over all the objects loaded.

I dont know guppy,
but if h.load(f) raises StopIteration upon eof, as seems implied by your proposal, then something like the following would work.

sets.extend(h.load(f) for _ in xrange(1e9))

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to