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

[WIP] Conferral Logic For Descriptors #429

Closed
wants to merge 1 commit into from

Conversation

rmorshea
Copy link
Contributor

@rmorshea rmorshea commented Jul 21, 2017

Summary

If a descriptor has specified that it inherits attributes, and there are descriptors of the given name in the lineage of the cls which have bequeathed one or more of those attributes, then they are conferred to that descriptor. If there are attributes that should be inherited, but that have not been bequeathed, an error will be raised.

class Grandparent(HasTraits):
    i = Int(help="something descriptive")

class Parent(Grandparent):
    # Has the same help string as Grandparent.i
    i = Int().inherit("help")

class Child(Parent):
    # raises an error because no descriptor 'i'
    # in the lineage of the class Child specified
    # that it was bequeathing its "default_value"
    i = Int().inherit("default_value")

To Do

  • Testing
  • Docs for TraitType methods

Possible Changes

  • Instead of having the methods TraitType.inherit and TraitType.bequeath we include them as argument in TraitType.__init__. I'm not sure what looks syntactically cleaner.

@rmorshea rmorshea changed the title Conferral Logic For Descriptors [WIP] Conferral Logic For Descriptors Jul 21, 2017
@@ -352,6 +352,8 @@ class that does the following:
"""

name = None
bequeaths = ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does bequeaths accomplish that inherits alone does not? Do we really need to specify an attribute as inheritable? Can we try a version with just inherits?

@Carreau Carreau added the Closed PR Stalled PR, feel free to resurrect. label May 31, 2020
@Carreau
Copy link
Member

Carreau commented May 31, 2020

Closing as state for a few years, apologies for not getting this in. I want to avoid having multiple page on stale PRs on this repository.

Labelling accordingly feel free to reopen.

@Carreau Carreau closed this May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed PR Stalled PR, feel free to resurrect.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants