On 08/09/2017 12:59 PM, Ian Pilcher wrote:

I do want to prevent frozenset.__init__ from being called *again* when
an existing instance is returned, so I've decided to take this

     def __new__(cls, *args, **kwargs):
         self = super(UniqueSet, cls).__new__(cls, *args, **kwargs)
         self._initialized = False
         return UniqueSet._registry.setdefault(self, self)

     def __init__(self, *args, **kwargs):
         if not self._initialized:
             super(UniqueSet, self).__init__(self, *args, **kwargs)
             self._initialized = True

Whom do you think is going to call __init__ a second time?



Reply via email to