list.extend([]) Question
Dan Brown
fsenzeru at gmail.com
Sat Jan 30 10:43:37 EST 2010
On Jan 30, 8:38 am, "Alf P. Steinbach" <al... at start.no> wrote:
> It does.
>
> 'extend' is an operation that /modifies/ the array.
>
> It just returns None as its expression result, in the same way as e.g. the
> Python 3.x 'print' (another pure "doer" operation).
>
> >>> L = ['a']
> >>> L
> ['a']
> >>> L2 = L.extend( [] )
> >>> L2
> >>> L2 is None
> True
> >>> L
> ['a']
> >>> _
>
> Cheers & hth.,
>
> - Alf
Aha. Well, I feel a bit silly for not thinking to try it that way.
Thanks!
More information about the Python-list
mailing list