Replies: 1 comment 3 replies
-
What is the difference from this? def create_connection():
return pymysql.connect(...)
with create_connection() as conn:
# first use
with create_connection() as conn:
# second use I don't want to implement "maybe convenient for some people" behaviors. Such behaviors make long-term maintenance cost. Convenient features must be implemented in the higher layer as possible. Low-level library must focus on low-level. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
if db drop the connection, context manager
with
do a reconnect in__enter__()
Beta Was this translation helpful? Give feedback.
All reactions