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

Xavier Ho contact at xavierho.com
Tue Jul 14 11:54:05 EDT 2009


I see. Thanks!

Ching-Yun "Xavier" Ho, Technical Artist

Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: contact at xavierho.com
Website: http://xavierho.com/


On Tue, Jul 14, 2009 at 11:20 PM, Jochen Schulz <ml at well-adjusted.de> wrote:

> 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>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkpcoiwACgkQ+AfZydWK2zmchgCfZjRCOGTa0OZ1Q045sCLZfpvD
> EIEAnjJ8/uNwPYFfCsGNbQIDd5+LnkbA
> =fCdV
> -----END PGP SIGNATURE-----
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090714/cc25e4ed/attachment-0001.html>


More information about the Python-list mailing list