* 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, 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
--
http://mail.python.org/mailman/listinfo/python-list