Re: list.extend([]) Question

2010-02-06 Thread Bruno Desthuilliers
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

Re: list.extend([]) Question

2010-02-05 Thread Jack Diederich
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

Re: list.extend([]) Question

2010-02-05 Thread Gerald Britton
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.

Re: list.extend([]) Question

2010-02-05 Thread Aahz
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/

Re: list.extend([]) Question

2010-01-30 Thread Steve Holden
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

Re: list.extend([]) Question

2010-01-30 Thread Dan Brown
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'] >    >>>

Re: list.extend([]) Question

2010-01-30 Thread Andre Engels
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

Re: list.extend([]) Question

2010-01-30 Thread Alf P. Steinbach
* 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,

list.extend([]) Question

2010-01-30 Thread 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. -- http://mail.python.org/mailman/listinfo/python-list