feature - better connection syntax #891
jmarshall9120
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
connect does not return a connection but the with and async with syntax is fully supported: https://github.com/FreeOpcUa/opcua-asyncio/blob/master/examples/client-minimal.py as for which one is more common or correct I have no ideas. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I feel like the connection syntax here is a little off base from most other python libraries that handle similar operations. Currently we connect in two flavors:
A far more conventional approach would be to return a
connection
object which would functionally be what theclient
object currently is. Theclient
object would become a factory that returns the connection and allows access consistently visa vi thewith
operator. This is what really makes it 'worth it' it terms of python IMO, as it saves lots of boiler plate.Any thoughts toward this? The implementation has been done in many other packages, so we could just monkey see monkey do. Compatibility for this sort of thing has also been solved by passing unknown methods down to the
connection
classAn example of package that implemented this a little into the lifespan of the package would be SQLAlchemy.
Beta Was this translation helpful? Give feedback.
All reactions