Closed buffer closed 7 years ago
Also, creating a context fails on Python 3:
self = <v8py.context.Context object at 0x7ff3ba7d0518>
args = (<class 'test_global.Global.<locals>.Global'>,), kwargs = {}
def __init__(self, *args, **kwargs):
> _v8py.Context.__init__(self, *args, **kwargs)
E TypeError: object.__init__() takes no parameters
v8py/context.py:5: TypeError
Context as a context manager could be useful so that it can be used directly in with statements without first having to be wrapped by contextlib.closing(). Apart from being a Pythonic approach, it would also allow to manage some initialization/destruction details transparently in the next future if needed.
In v8py, contexts don't need to be opened or closed, they can just be used.
Why is it useful for Context to be a context manager?