Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-11 Thread Chris Withers
Sverker Nilsson wrote: If you just use heap(), and only want total memory not relative to a reference point, you can just use hpy() directly. So rather than: CASE 1: h=hpy() h.heap().dump(...) #other code, the data internal to h is still around h.heap().dump(...) you'd do: CASE 2:

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-11 Thread Ethan Furman
Chris Withers wrote: Sverker Nilsson wrote: The __repr__ I use don't have the enclosing , granted, maybe I missed this or it wasn't in the docs in 2005 or I didn't think it was important (still don't) but was that really what the complain was about? No, it was about the fact that when I do

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-10 Thread Sverker Nilsson
On Wed, 2009-09-09 at 13:47 +0100, Chris Withers wrote: Sverker Nilsson wrote: As the enclosing class or frame is deallocated, so is its attribute h itself. Right, but as long as the h hangs around, it hangs on to all the memory it's used to build its stats, right? This caused me

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-09 Thread Chris Withers
Sverker Nilsson wrote: But I don't think I would want to risk breaking someone's code just for this when we could just add a new method. I don't think anyone will be relying on StopIteration being raised. If you're worried, do the next release as a 0.10.0 release and explain the backwards

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-08 Thread Sverker Nilsson
On Mon, 2009-09-07 at 16:53 +0100, Chris Withers wrote: Sverker Nilsson wrote: I hope the new loadall method as I wrote about before will resolve this. def loadall(self,f): ''' Generates all objects from an open file f or a file named f''' if isinstance(f,basestring):

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-07 Thread Chris Withers
Sverker Nilsson wrote: I hope the new loadall method as I wrote about before will resolve this. def loadall(self,f): ''' Generates all objects from an open file f or a file named f''' if isinstance(f,basestring): f=open(f) while True: yield self.load(f) It would be