Anonymous function: Difference between revisions

Content deleted Content added
m Sorting: Combine code
m Sorting: Combine code
Line 33:
a = ['three', 'two', 'four']
a.sort(lambda x,y: cmp(len(x), len(y)))
print a
</source>
 
which results in
<source lang="python">
['two', 'four', 'three']
</source>