You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* we don't add cursor, blob or backup to the module since users shouldn't be able to instantiate them directly */
However, instantiating is not the only reason for exposing a class. Maybe people want to use isinstance, for example. However I think the most compelling use case is to support PEP 484 type hints. Right now, in a file where all other function parameters are annotated, we have the choice to either leave a function unannotated (or annotated as Any which is not much better), or to try to get the Cursor type manually with e.g. Cursor = type(apsw.Connection(":memory:").cursor()) and use that to annotate our functions. Neither of these are particularly satisfying; it would be nicer if apsw.Cursor and friends were directly accessible, even if they are not directly instantiable.
The text was updated successfully, but these errors were encountered:
Cursor
,Blob
, andBackup
are not members of theapsw
module, as explained here:apsw/src/apsw.c
Line 1303 in d0ce7ac
However, instantiating is not the only reason for exposing a class. Maybe people want to use
isinstance
, for example. However I think the most compelling use case is to support PEP 484 type hints. Right now, in a file where all other function parameters are annotated, we have the choice to either leave a function unannotated (or annotated asAny
which is not much better), or to try to get theCursor
type manually with e.g.Cursor = type(apsw.Connection(":memory:").cursor())
and use that to annotate our functions. Neither of these are particularly satisfying; it would be nicer ifapsw.Cursor
and friends were directly accessible, even if they are not directly instantiable.The text was updated successfully, but these errors were encountered: