[Python-Dev] PyXXX_Size vs. PyXXX_Length

Greg Stein gstein@lyra.org
Tue, 11 Jul 2000 03:10:36 -0700

On Tue, Jul 11, 2000 at 11:32:44AM +0200, Vladimir Marangozov wrote:
> Fredrik Lundh wrote:
> > 
> > jeremy wrote:
> > 
> > > Tuple, List, String, and Dict have a PyXXX_Size method.  The abstract
> > > object interface uses PySequence_Length.  This is inconsistent and
> > > hard to remember.  Can we add PySequence_Size and mark Length as
> > > deprecated?
> > 
> > don't forget PyObject_Length and PyMapping_Length...
> Why deprecate? There's nothing wrong with these names.
> However, for conveniency, it would make sense to have
> PyXXX_Size macros, synonyms for the PyXXX_Length functions.

Because having both names is even worse than having inconsistent names. The
question will always arise "what is the difference? why should I use one
over the other?" You can tell people they are the same until you're blue in
the face -- the question will still come up. Maybe after a while, the
question won't come up any more. But then you have to answer, "okay. so
they're exactly the same. why have two of them, then?" :-)

> Or vice versa. Have _Length macros, synonyms for _Size functions.
> However, this is not backwards (binary) compatible, which I
> believe is harmless for a new release, but the recent Windows
> DLL thread reminds that bin compatibility accross versions
> is somewhat important.

Binary compatibility in Open Source software is a pipe dream. There is
absolutely no sense in trying to worry about it, and even more sense to
explicitly bail out with "that doesn't work."


Greg Stein, http://www.lyra.org/