Re: [Tutor] Trying to understand sys.getrefcount()

2006-10-13 Thread Alan Gauld
> class junk(object): > ... pass > ... sys.getrefcount(junk) > 5 > I understand why j1 is 1 higher than I expect, based on the docs, > but why > does getrefcount(junk) return 5 before any instances of class junk > are made? Because Python s holding 4 references to the class object inte

[Tutor] Trying to understand sys.getrefcount()

2006-10-12 Thread Tony Cappellini
I'm using Python 2.3.4After reading this in the docs getrefcount( object) Return the reference count of the object. The count returned is generally one higher than you might expect, because it includes the (temporary) reference as an argument to getrefcount().I decided to try some experiments c