Thank you for your answers. Very appreciated.
I ended up doing it as follows:
class MetaLock(type):
def __init__(cls, *args):
super().__init__(*args)
cls.lock = Lock()
cls.instances = []
def register(cls, instance):
cls.instances.append(instance)
def
On 1/24/2017 4:31 PM, This Wiederkehr wrote:
having a class definition:
class Test():
@classmethod
def __enter__(cls):
pass
@classmethod
def __exit__(cls, exception_type, execption_value, callback):
pass
now using this as a contextmanager does not work, even though Test is an
object
On 01/24/2017 02:35 PM, Ethan Furman wrote:
On 01/24/2017 01:31 PM, This Wiederkehr wrote:
having a class definition:
class Test():
@classmethod
def __enter__(cls):
pass
@classmethod
def __exit__(cls, exception_type, execption_value, callback):
pass
now using this as a contextman
On 01/24/2017 01:31 PM, This Wiederkehr wrote:
having a class definition:
class Test():
@classmethod
def __enter__(cls):
pass
@classmethod
def __exit__(cls, exception_type, execption_value, callback):
pass
now using this as a contextmanager does not work, even though Test is an
obj
On Tue, Jan 24, 2017 at 2:31 PM, This Wiederkehr
wrote:
> Hellou
>
> having a class definition:
>
> class Test():
>
> @classmethod
> def __enter__(cls):
> pass
>
> @classmethod
> def __exit__(cls, exception_type, execption_value, callback):
> pass
>
> now using this as a contextmanager doe