◐ Shell
clean mode source ↗

bpo-45243: Expose SQLite connection limits as `sqlite3.Connection` attributes by erlend-aasland · Pull Request #28790 · python/cpython

old = con.SQLITE_LIMIT_LENGTH
con.SQLITE_LIMIT_LENGTH = new

does not look nice to me. If go this way, I would prefer

old = con.limit.length
con.limit.length = new

But do we have precedences of such getters and setters in the stdlib?

There are also disadvantages in comparison with traditional getlimit()/setlimit().

  1. setlimit() sets a new limit and returns an old limit at one operation. Atomically (guarded by the GIL).
  2. getlimit()/setlimit() can be used for new limits not supported by the sqlite3 module yet. Just use some numeric constant.