I want to do something like
list = [6,4,1,10,8].sort().reverse()
or
zip([x**2 for x in xrange(5)], [x**3 for x in xrange(5)].reverse()])
but this doesn’t work because methods on list doesn’t return the original object, so they’re not chainable.
Do I have to do this using multiple lines or is there some cool functional programming magic I can do in python to achieve this in one line?
You want
sorted()andreversed().