a=[1,2,3,4].reverse() - why "a" is None?

Andre Engels andreengels at gmail.com
Mon Oct 12 03:32:43 EDT 2009


The reverse function is a function to reverse the list in place, not a
function to get the reverse of the list:

x = [1,2,3,4]
y = x
z = x.reverse()

will result in:

x = y = [4,3,2,1]
z = None


-- 
André Engels, andreengels at gmail.com



More information about the Python-list mailing list