[Python-Dev] Removing tp_compare?

Mark Dickinson dickinsm at gmail.com
Sat Jan 31 22:07:37 CET 2009


Here's a question (actually, three questions) for python-dev that
came up in the issue 1717 (removing cmp) discussion.

Once the cmp removal is complete, the type object's tp_compare
slot will no longer be used.  The current plan is to rename it to
tp_reserved, change its type to (void *), and raise TypeError when
initializing any type that attempts to put something nonzero into
that slot.  But another possibility would be to remove it entirely.
So...

Questions:

(1) Is it desirable to remove tp_compare entirely, instead of
just renaming it?

(2) If so, for which Python version should that removal take place?
3.0.1?  3.1.0?  4.0?

and the all-important bikeshed question:

(3) In the meantime, what should the renamed slot be called?
tp_reserved?  In the issue 1717 discussion, Raymond suggested
tp_deprecated_compare.

Any thoughts?  My own opinion is that it really doesn't matter
that much if the slot is left in;  it's just a little annoying to have
such backwards-compatibility baggage already present in
the shiny new 3.0 series.  A little like finding a big scratch
on your brand-new bright yellow Hummer H3.  Or not.

N.B. The same questions apply to nb_reserved (which used
to be nb_long) in the PyNumberMethods structure.

Mark


More information about the Python-Dev mailing list