[Python-Dev] file.writelines("foo\n","bar\n")

Tim Peters tim.one@home.com
Tue, 29 May 2001 00:16:46 -0400


[Martin]
> I took a special look at METH_OLDARGS occurrences.

[GregE]
> Shouldn't all these be removed? I would have thought
> list.append was the last one!

I count 42 of them remaining, usually for 0-argument functions.
METH_OLDARGS is faster than METH_VARARGS in that case, and the callee can
distinguish between "called with nothing" and "called with something" under
OLDARGS.  However, they don't appear to catch keyword args:

>>> {}.clear(2)  # complains
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: function takes no arguments
>>> {}.clear(val=12, hohoho=666)  # accepts nonsense silently
>>>

the-more-you-look-the-messier-it-gets-ly y'rs  - tim