list.extend([]) Question

Gerald Britton gerald.britton at
Fri Feb 5 17:31:52 CET 2010

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 <aahz at> wrote:
> In article <088e7a24-b0d0-4d43-bee7-193e5eaefe57 at>,
> Dan Brown  <fsenzeru at> 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.
> --
> Aahz (aahz at           <*>
> import antigravity
> --

Gerald Britton

More information about the Python-list mailing list