[Python-Dev] Special-casing "O"

Michael Hudson mwh@python.net
Sun, 27 May 2001 22:32:48 +0100 (BST)


On Sun, 27 May 2001, Tim Peters wrote:

> Next question:  why isn't builtin_len using METH_OLDARGS instead?  Is
> there some advantage to using METH_VARARGS in this case?

So you can't do

>>> len(1,2)
2

a la list.append, socket.connect pre 2.0?  (or was it 1.6?)

My imprssion is that generally METH_VARARGS is saner than METH_OLDARGS
(ie. more consistent).  It seems the proposed METH_O is basically
METH_OLDARGS + the restriction that there is in fact only one argument, so
we save a tuple allocation over METH_VARARGS, but get argument count
checking over METH_OLDARGS.

Cheers,
M.