Newbie help with extend()

Steve Holton sholton at mindspring.com
Mon Mar 20 01:38:52 CET 2000


Greetings-

Can anyone post a short example showing the extend method of list?

Here's what I'm seeing:

[sholton at kest sholton]$ python
Python 1.5.1 (#1, Mar 21 1999, 22:49:36)  [GCC egcs-2.91.66
19990314/Li on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> a=[1,2]
>>> type(a)
<type 'list'>
>>> b=[3,4]
>>> type(b)
<type 'list'>
>>> a.extend(b)

I'm expecting this to set a to [1, 2, 3, 4]
but instead I get:

Traceback (innermost last):
  File "<stdin>", line 1, in ?
AttributeError: extend

Is this a 1.5.2 feature?

-- 
sholton at mindspring.com
If the answers are increasing and the questions decreasing,
Then you're on the road to knowledge, but you're headed the wrong
direction.



More information about the Python-list mailing list