Skip to content

Design type creation API #4

Open
@encukou

Description

@encukou

Type creation is a pain point in the current Limited API. (The problems are systemic -- module spec has similar issues -- but they're most visible there & a solution should be applicable elsewhere.)
The initial description -- PyType_Spec now and “layout and inheritance description” in #2 (comment) -- can't easily be extended. The current extension mechanism, slots, is not type-safe. Adding methods and properties to a live class (my interpretation of Mark's “current thinking” in the linked issue) means modifying a possibly-immutable class, a no-no as it could invalidate useful invariants.

We could have an opaque “configuration” object that's allocated and configured using functions, with a “finalize” function that turns it into a class. Not sure about performance and other implications there.

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