Skip to content

how to extend dynamic defaults with super #256

@minrk

Description

@minrk

With traitlets 4.0, it's easy to extend dynamic defaults of parent classes, because the name of the default generator is part of the public API:

class SubClass(Parent):
    def _some_trait_default(self):
        previous_default = super()._trait_default()
        return modified(previous_default)

Now that the name of the method that happens to implement the default generator is no longer a public API, what's the best way to determine what the dynamic default would have been in the parent class, and then extend it in a subclass?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions