> 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 internally.
For example the namespace dictionary will have one. I've no idea what
all the others will be but presumably thats whats happening. Remember
classes are objects too.

Alan G. 


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to