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 <[email protected]> wrote: > In article <[email protected]>, > Dan Brown <[email protected]> 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/doc/faq/general/#why-doesn-t-list-sort-return-the-sorted-list > -- > Aahz ([email protected]) <*> http://www.pythoncraft.com/ > > import antigravity > -- > http://mail.python.org/mailman/listinfo/python-list > -- Gerald Britton -- http://mail.python.org/mailman/listinfo/python-list
