{"action":"created","issue":{"url":"https://api.github.com/repos/ipython/traitlets/issues/70","labels_url":"https://api.github.com/repos/ipython/traitlets/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/ipython/traitlets/issues/70/comments","events_url":"https://api.github.com/repos/ipython/traitlets/issues/70/events","html_url":"https://github.com/ipython/traitlets/pull/70","id":103597666,"number":70,"title":"On enabling other descriptors than TraitType","user":{"login":"SylvainCorlay","id":2397974,"avatar_url":"https://avatars.githubusercontent.com/u/2397974?v=3","gravatar_id":"","url":"https://api.github.com/users/SylvainCorlay","html_url":"https://github.com/SylvainCorlay","followers_url":"https://api.github.com/users/SylvainCorlay/followers","following_url":"https://api.github.com/users/SylvainCorlay/following{/other_user}","gists_url":"https://api.github.com/users/SylvainCorlay/gists{/gist_id}","starred_url":"https://api.github.com/users/SylvainCorlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SylvainCorlay/subscriptions","organizations_url":"https://api.github.com/users/SylvainCorlay/orgs","repos_url":"https://api.github.com/users/SylvainCorlay/repos","events_url":"https://api.github.com/users/SylvainCorlay/events{/privacy}","received_events_url":"https://api.github.com/users/SylvainCorlay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-08-27T21:22:46Z","updated_at":"2015-09-22T01:02:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ipython/traitlets/pulls/70","html_url":"https://github.com/ipython/traitlets/pull/70","diff_url":"https://github.com/ipython/traitlets/pull/70.diff","patch_url":"https://github.com/ipython/traitlets/pull/70.patch"},"body":"The metaclass logic in traitlets is very simple, especially if we remove the deprecated portion of the code. All it does is to decorate the descriptor instances in the dictionary with a `name` attribute.\r\n\r\nWe recently introduced a [BaseDescriptor](https://github.com/ipython/traitlets/blob/master/traitlets/traitlets.py#L291) base class to `TraitType`. The requirement for the specialization to `BaseDescriptor` is to implement `instance_init`, which is called in the `__new__` method of `HasTraits`. This was meant to enable using other descriptors than `TraitType` to benefit from the metaclass magic.\r\n\r\nWithin traitlets, we already have another specialization of `BaseDescriptor`, that is`ObserveHandler`. In widgets, we used it for the work on signaling. @rmorshea is also implementing the registration of custom cross validators with the same mechanism.\r\n\r\nThe number of different descriptors that we will introduce is probably going to grow. (Signaling, event-full containers etc), hence I opened this PR, which separates the descriptor mechanics from HasTraits, to acknowledge the fact that other descriptors than `TraitType`."},"comment":{"url":"https://api.github.com/repos/ipython/traitlets/issues/comments/142150811","html_url":"https://github.com/ipython/traitlets/pull/70#issuecomment-142150811","issue_url":"https://api.github.com/repos/ipython/traitlets/issues/70","id":142150811,"user":{"login":"SylvainCorlay","id":2397974,"avatar_url":"https://avatars.githubusercontent.com/u/2397974?v=3","gravatar_id":"","url":"https://api.github.com/users/SylvainCorlay","html_url":"https://github.com/SylvainCorlay","followers_url":"https://api.github.com/users/SylvainCorlay/followers","following_url":"https://api.github.com/users/SylvainCorlay/following{/other_user}","gists_url":"https://api.github.com/users/SylvainCorlay/gists{/gist_id}","starred_url":"https://api.github.com/users/SylvainCorlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SylvainCorlay/subscriptions","organizations_url":"https://api.github.com/users/SylvainCorlay/orgs","repos_url":"https://api.github.com/users/SylvainCorlay/repos","events_url":"https://api.github.com/users/SylvainCorlay/events{/privacy}","received_events_url":"https://api.github.com/users/SylvainCorlay/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T01:02:25Z","updated_at":"2015-09-22T01:02:25Z","body":"_trait_notifiers, _trait_values,and _trait_validators sort of come together and I am not sure what it buys us to consider cases where only some of them exist. When you change the value of a trait type, all these attributes are used."}}