I would like to ensure that the class is only instantiated within a "with" statement.
i.e. this one is ok:
with X() as x: ...and this is not:
x = X()How can I ensure such functionality?
I would like to ensure that the class is only instantiated within a "with" statement.
i.e. this one is ok:
with X() as x: ...and this is not:
x = X()How can I ensure such functionality?