import functools


class Singleton:

    def __init__(self, func):
        self._fun = func

    @functools.wraps
    def __call__(self, *args, **kwargs):
        return self._fun(*args, **kwargs)



@Singleton
class MyClass(object):

    def __init__(self, value):
        self.value = value
        print(f"第{value}次__init__")


print(type(MyClass))

# print(MyClass())
# print(MyClass())




f746814a948156be389be60f0603e5dcff9ae4b4
<mask token>


class Singleton:

    def __init__(self, func):
        self._fun = func
    <mask token>


@Singleton
class MyClass(object):

    def __init__(self, value):
        self.value = value
        print(f'第{value}次__init__')


<mask token>

<mask token>


class Singleton:

    def __init__(self, func):
        self._fun = func

    @functools.wraps
    def __call__(self, *args, **kwargs):
        return self._fun(*args, **kwargs)


@Singleton
class MyClass(object):

    def __init__(self, value):
        self.value = value
        print(f'第{value}次__init__')


<mask token>

<mask token>


class Singleton:

    def __init__(self, func):
        self._fun = func

    @functools.wraps
    def __call__(self, *args, **kwargs):
        return self._fun(*args, **kwargs)


@Singleton
class MyClass(object):

    def __init__(self, value):
        self.value = value
        print(f'第{value}次__init__')


print(type(MyClass))

import functools


class Singleton:

    def __init__(self, func):
        self._fun = func

    @functools.wraps
    def __call__(self, *args, **kwargs):
        return self._fun(*args, **kwargs)


@Singleton
class MyClass(object):

    def __init__(self, value):
        self.value = value
        print(f'第{value}次__init__')


print(type(MyClass))

import functools


class Singleton:

    def __init__(self, func):
        self._fun = func

    @functools.wraps
    def __call__(self, *args, **kwargs):
        return self._fun(*args, **kwargs)



@Singleton
class MyClass(object):

    def __init__(self, value):
        self.value = value
        print(f"第{value}次__init__")


print(type(MyClass))

# print(MyClass())
# print(MyClass())



