Skip to content

Consider exposing Cursor, Blob, and Backup types #273

@akirchhoff-modular

Description

@akirchhoff-modular

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions