Open BlackstoneEngineering opened 8 years ago
It's more lines actually:
e = connector.getResourceValue(id, KNOCK_RESOURCE)
while not e.result and not e.error:
None
if e.error:
raise Error(e.error)
return e.result
vs.
return connector.getResourceValue(id, bla)
While I like the idea it wont work for most of the connector API calls since many of them are asynchronous and not guaranteed to complete. I have seen it happen on multiple ocassions where I am given an Async ID by connector but nothing ever comes back for that Async ID. In this case your blocking implementation would either never return. If as a counter measure you implement a timeout then you risk timing out before the value is returned.
Do you have a proposed solution for this?
@janjongboom : has expressed that the async calls should be blocking by default to be more pythonic.
This would eliminate the current need for
which amounts to 2 lines per api use.