
[me]
I've often wished that the instance type object had an (optimized) __decref__ slot. With nothing but hand-waving to support it, I'll claim that would enable all these games.
[Guido]
Without context, I don't know when this would be called. If you want this called on all DECREFs (regardless of the refcount value), realize that this is a huge slowdown because it would mean the DECREF macro has to inspect the type object, which means several indirections. This would slow down *every* DECREF operation, not just those on instances with a __decref__ slot, because the DECREF macro doesn't know the type of the object!
This was more 2.0-ish speculation, and really thinking of classic C++ ref counting where decref would be a function call, not a macro. Still a slowdown, of course, but not quite so massive. The upside is opening up all kinds of tricks at the type object and user class levels, (such as weak refs and copy on write etc). Worth it? I'd think so, but I'm not a speed demon. - Gordon