Python拾遺の特殊関数_len__


# -*- coding: utf-8 -*-


"""
               list        len()                
             。  ,           __len__(),        
       ,    ,       __len__()  ,    len()     Family  “  ”
"""


class Family(object):

    def __init__(self, *args):
        self.names = args

    def __len__(self):
        #            ,       
        return len(self.names)


if __name__ == '__main__':
    menber = Family('Dada', 'Mama', 'You')
    print len(menber)