For example:
class Foo:
def __init__(self):
self.bar = "baz"
def test(self):
return "secret value that can only accessed in this function!!"
How can I do this:
x = Foo()
with x.test() as f:
print(f)
# "secret value that can only be accessed in this function!!"
Without raising an error?