Skip to content

Be lazier about variants in methods #6

@pganssle

Description

@pganssle

The way this works now, the VariantFunction descriptor will create a new VariantMethod at least for every instance of the parent class, possibly on every lookup of either the primary or one of the variants. This is particularly problematic because instantiating a VariantMethod actually eagerly binds every variant at lookup time.

I believe that we can fix this by changing VariantMethod so that rather than eagerly creating bound method variants for every variant of the primary when instantiated, we have a lookup table that lazily creates them in __getattr__.

The big caveat here is that if you just do it the naive way, I'm fairly certain that it will ruin introspection and (probably ruin documentation generation as a consequence), so I think we'll also have to be clever about the introspection.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions