Why does extend() fail in this case, and what am I doing wrong?

Jochen Schulz ml at well-adjusted.de
Tue Jul 14 11:20:13 EDT 2009


Xavier Ho:
>
> Why doesn't the second output print [1, 2, 3, .... , 7, 8, 9] ?
-- snip
> print a.n.extend([6, 7, 8, 9])

extend doesn't fail. It just returns None and extends the list in place.

In [1]: l = [1, 2, 3]

In [2]: l.extend([4, 5, 6])

In [3]: l
Out[3]: [1, 2, 3, 4, 5, 6]


J.
-- 
When I get home from the supermarket I don't know what to do with all the
plastic.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090714/a85f7b98/attachment-0001.sig>


More information about the Python-list mailing list