[Python-Dev] Q: why doesn't list.extend use the sequence interface?

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Fri, 16 Jun 2000 18:24:26 +0200


(the eff-bot is back!)

is there any special reason for this restriction:

Python 1.6a2 (#0, Jun 14 2000, 23:07:49) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
>>> a =3D [1, 2, 3]
>>> a.extend((4, 5, 6))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: list.extend() argument must be a list

from the look of it, it should be trivial to change list.extend
to use the abstract sequence API instead of the list API.

has anyone benchmarked the abstract sequence API?  how
much slower is it?  would it be a good idea to treat lists as
a special case, to avoid slowing down existing code?

other comments?

if I don't hear anything, I'll post patches later this weekend.

</F>