Re: Python3.7 singleton is not unique anymore

2019-09-17 Thread Eko palypse
Shame on me :-) Thank you very much Ethan. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3.7 singleton is not unique anymore

2019-09-17 Thread Ethan Furman
On 09/17/2019 09:45 AM, Eko palypse wrote: else: class FOO(): def __init__(self, metaclass=Singleton): In your test code, the `metaclass=Singleton` should be in `class Foo`: class FOO(metaclass=Singleton): ... -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/p

Python3.7 singleton is not unique anymore

2019-09-17 Thread Eko palypse
Using the following code in Python3.7 doesn't make FOO to be singleton anymore. import sys class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)