Newbie help with extend() 
Author Message
 Newbie help with extend()

Steve Holton has problems with list.extend:

Quote:
> python 1.5.1

That's the problem. Didn't appear until 1.5.2.

Quote:
> 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]

And it will when you upgrade.

- Gordon



Thu, 05 Sep 2002 03:00:00 GMT  
 Newbie help with extend()
Greetings-

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

Here's what I'm seeing:


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

Quote:
>>> 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?

--

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



Fri, 06 Sep 2002 03:00:00 GMT  
 Newbie help with extend()

Quote:

>Greetings-

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

>Here's what I'm seeing:


>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?

Appears to be.  This works fine with PythonWin version 1.5.2.


Fri, 06 Sep 2002 03:00:00 GMT  
 Newbie help with extend()

Quote:

> Can anyone post a short example showing the extend method of list?
<snip>
> Is this a 1.5.2 feature?

Yes -- your example would work fine in 1.5.2
--

http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com


Fri, 06 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help for extending newbie

2. newbie question: extended key

3. Newbie question on extending Python with C

4. newbie-question: extending python with c++

5. Newbie problem with extending & embedding

6. embedding & extending [SWIG,newbie]

7. NEWBIE: Extending Python with C

8. Array.extend versus instance.extend

9. Extended Character help

10. Graphics help by newbie, please help

11. Looking for help to find/buy an app to extend Contact Manager

12. Help:Extend API sample program?

 

 
Powered by phpBB® Forum Software