Gerald Britton a écrit :
I think it's because when you do ['a'].extend([]) or whatever, the
result is whatever the method "extend" returns. But "extend" has no
return value
It does : it returns None.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Feb 5, 2010 at 11:31 AM, Gerald Britton
wrote:
> I think it's because when you do ['a'].extend([]) or whatever, the
> result is whatever the method "extend" returns. But "extend" has no
> return value, hence you will see None if you do this interactively.
>
That sums it up. In Python th
I think it's because when you do ['a'].extend([]) or whatever, the
result is whatever the method "extend" returns. But "extend" has no
return value, hence you will see None if you do this interactively.
On Fri, Feb 5, 2010 at 10:55 AM, Aahz wrote:
> In article <088e7a24-b0d0-4d43-bee7-193e5eaef.
In article <088e7a24-b0d0-4d43-bee7-193e5eaef...@b7g2000pro.googlegroups.com>,
Dan Brown wrote:
>
>Why does extending a list with the empty list result in None? It
>seems very counterintuitive to me, at least --- I expected ['a'].extend
>([]) to result in ['a'], not None.
http://www.python.org/
Dan Brown wrote:
> Why does extending a list with the empty list result in None? It
> seems very counterintuitive to me, at least --- I expected ['a'].extend
> ([]) to result in ['a'], not None.
How very inconvenient of Python! What it actually does is create an
anonymous list containing only the
On Jan 30, 8:38 am, "Alf P. Steinbach" 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']
> >>>
On Sat, Jan 30, 2010 at 4:32 PM, Dan Brown wrote:
> Why does extending a list with the empty list result in None? It
> seems very counterintuitive to me, at least --- I expected ['a'].extend
> ([]) to result in ['a'], not None.
Extend is a method of the list. The list itself is changed, it does
* Dan Brown:
Why does extending a list with the empty list result in None? It
seems very counterintuitive to me, at least --- I expected ['a'].extend
([]) to result in ['a'], not None.
It does.
'extend' is an operation that /modifies/ the array.
It just returns None as its expression result,
Why does extending a list with the empty list result in None? It
seems very counterintuitive to me, at least --- I expected ['a'].extend
([]) to result in ['a'], not None.
--
http://mail.python.org/mailman/listinfo/python-list