[Python-Dev] Re: C new-style classes and GC

Jim Fulton jim@ZOPE.COM
Fri, 16 May 2003 15:33:29 -0400


Jeremy Hylton wrote:
> On Fri, 2003-05-16 at 13:08, Jim Fulton wrote:
> 
>>If you write types the New Way, there are no PyObject_New calls and
>>no need to call PyObject_GC_Track.
> 
> 
> I don't follow.  There are plenty of types that are garbage collectable
> that also use PyObject_GC_New.  One example is PyDict_New().  If
> something is widespread in the Python source tree (a common source of
> example code for programmers), it ought to be documented.

It is documented in the API reference. Perhaps the API reference
should explain that there's a prefered way to do things.

There should be one prefered way to write types. It just happens that
that way is a *new* way and most existing types don't follow that way.

In the how-to style manual, we should only document the one prefered
way to write new types.  We shouldn't describe all of the various
obsolete variations.

It's unfortunate that there aren't many examples of how to do things
the new way, although that's understandable, since the new way wasn't
documented until recently.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org