Are there plans to enable use of the python `with` statement?
For example, it would be useful to be able to do something like the
following (server implementation):
with MyThriftObject.containedObject as obj:
myvariable = obj.foo
# do something here
or:
obj = MyThriftObject()
obj.containedObjects = []
for my_dict in my_list_of_dicts:
with ContainedObject() as c:
# map my_dict to c here
obj.containedObjects.append(c)
Currently python throws errors such as:
AttributeError: 'MyThriftObject' object has no attribute '__exit__'
--
Phillip B Oldham
[email protected]
+44 (0) 7525 01 09 01