about sort and dictionary

Shi Mu samrobertsmith at gmail.com
Sun Nov 20 08:32:53 EST 2005


Got confused by the following code:
>>> a
[6, 3, 1]
>>> b
[4, 3, 1]
>>> c
{1: [[6, 3, 1], [4, 3, 1]], 2: [[6, 3, 1]]}
>>> c[2].append(b.sort())
>>> c
{1: [[6, 3, 1], [1, 3, 4]], 2: [[6, 3, 1], None]}
#why c can not append the sorted b??
>>> b.sort()
>>> b
[1, 3, 4]



More information about the Python-list mailing list