'''
http://pythoncentral.io/how-to-sort-a-list-tuple-or-object-with-sorted-in-python/
'''

class Customer:
    def __init__(self,name,age):
        self.name=name
        self.age=age


    def __repr__(self):
        return '{}:{}:{}'.format(self.__class__.__name__,self.name,self.age)


    def getkey(self,item):
        return self.age


if __name__ == '__main__':
    # c=Customer("muthu",12)
    # print c.__dict__

   customerList=[Customer("muthu",12),Customer("selvan",2),Customer("rev",102)]
   print customerList
   print sorted(customerList,key=Customer.getkey)

