Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider exposing Cursor, Blob, and Backup types #273

Closed
akirchhoff-modular opened this issue Jul 20, 2019 · 0 comments
Closed

Consider exposing Cursor, Blob, and Backup types #273

akirchhoff-modular opened this issue Jul 20, 2019 · 0 comments

Comments

@akirchhoff-modular
Copy link

Cursor, Blob, and Backup are not members of the apsw module, as explained here:

apsw/src/apsw.c

Line 1303 in d0ce7ac

/* 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant