I have implemented a lambda function to sort a list. now i want to remove all the negative objects from the list by using lambda functions .
dto_list.sort(key=lambda x: x.count, reverse=True)
any one know a way to write the lambda expression to do it? I could not find a proper tutorial
lambda
? Usually they are unnecessary and make code less readable. – jamylak May 16 '12 at 7:43sorted(dto_list, key=operator.attrgetter("count"), reverse=True)
– katrielalex May 16 '12 at 8:10