class SingletonMeta(type):
    def __init__(self, *args, **kwargs):
        self._instance = None
        super(SingletonMeta, self).__init__(*args, **kwargs)

    def __call__(self, *args, **kwargs):
        print("call")
        if not self._instance:
            self._instance = super(SingletonMeta, self).__call__(*args, **kwargs)
        return self._instance


class Person(metaclass=SingletonMeta):

    def __init__(self):
        self.name = 'kiennt'
        self.age = 26


a = Person()
print(a.name)  # kiennt
print(a.age)  # 26
b = Person()
print(b == a)  # True

17e2e28ca3c0998a606cb7abde3323acb9103bfb
class SingletonMeta(type):
    <mask token>
    <mask token>


class Person(metaclass=SingletonMeta):

    def __init__(self):
        self.name = 'kiennt'
        self.age = 26


<mask token>

class SingletonMeta(type):

    def __init__(self, *args, **kwargs):
        self._instance = None
        super(SingletonMeta, self).__init__(*args, **kwargs)

    def __call__(self, *args, **kwargs):
        print('call')
        if not self._instance:
            self._instance = super(SingletonMeta, self).__call__(*args, **
                kwargs)
        return self._instance


class Person(metaclass=SingletonMeta):

    def __init__(self):
        self.name = 'kiennt'
        self.age = 26


<mask token>

class SingletonMeta(type):

    def __init__(self, *args, **kwargs):
        self._instance = None
        super(SingletonMeta, self).__init__(*args, **kwargs)

    def __call__(self, *args, **kwargs):
        print('call')
        if not self._instance:
            self._instance = super(SingletonMeta, self).__call__(*args, **
                kwargs)
        return self._instance


class Person(metaclass=SingletonMeta):

    def __init__(self):
        self.name = 'kiennt'
        self.age = 26


<mask token>
print(a.name)
print(a.age)
<mask token>
print(b == a)

class SingletonMeta(type):

    def __init__(self, *args, **kwargs):
        self._instance = None
        super(SingletonMeta, self).__init__(*args, **kwargs)

    def __call__(self, *args, **kwargs):
        print('call')
        if not self._instance:
            self._instance = super(SingletonMeta, self).__call__(*args, **
                kwargs)
        return self._instance


class Person(metaclass=SingletonMeta):

    def __init__(self):
        self.name = 'kiennt'
        self.age = 26


a = Person()
print(a.name)
print(a.age)
b = Person()
print(b == a)

class SingletonMeta(type):
    def __init__(self, *args, **kwargs):
        self._instance = None
        super(SingletonMeta, self).__init__(*args, **kwargs)

    def __call__(self, *args, **kwargs):
        print("call")
        if not self._instance:
            self._instance = super(SingletonMeta, self).__call__(*args, **kwargs)
        return self._instance


class Person(metaclass=SingletonMeta):

    def __init__(self):
        self.name = 'kiennt'
        self.age = 26


a = Person()
print(a.name)  # kiennt
print(a.age)  # 26
b = Person()
print(b == a)  # True
