Open hupili opened 10 years ago
More problem of Style2: inconvenient for logging and error handling.
params = {...}
response = self.xx_request(method, params)
log(params, response)
error_handle(params, response)
Enclosing parameters in a definite argument is a better style for the vertical interfaces.
There are several vertical interfaces:
renren_request
sina_request
.tencent_request
.sql_request('query string with param placeholder', (param1, param2, etc))
(conceptually here; will be reflected later)Facts about vertical interfaces:
Style 1:
Style2:
Problem of style2: (when the param of the API is not a valid Python identifier)
Although the vertical interfaces are mainly there to support horizontal interfaces (the major use case), some users want to use vertical interfaces directly to extend the function. We can not unify the data structures but we can make the invocation style coherent.
Call for discussion. pros/ cons with cases.