traits
traits copied to clipboard
Observable typed attributes for Python classes
Currently the observe machinery raises an exception when there's no trait matching the given name. For example, in ```python from traits.api import HasTraits, Instance, observe class Foo(HasTraits): pass class A(HasTraits):...
Reading the value of an `Event()` trait should be an error, even when it's contained in another trait type. But we have the following behaviour in current Traits: ```python >>>...
Traits doesn't need the MetaHasTraits metaclass: everything it needs to be able to do it can do with the aid of `__init_subclasses__`, introduced in Python 3.6. See #1551 for POC...
Currently the new `TraitDict` expects to be supplied a separate `key_validator` and a `value_validator`. We should perhaps be using a single `item_validator` which is given both the key and the...
Currently all three of the new container classes dispatch notification via a simple: ``` for notifier in self.notifiers: notifier(self, index, removed, added) ``` This means that if a single notifier...
At the moment `Expression` trait makes use of `setattr_original_value` and has a validation method that modifies given value. This has caused issues with default value setting (https://github.com/enthought/traits/issues/1087, https://github.com/enthought/traits/issues/1096). The use...
After code resembling this: ```python class Model(HasStrictTraits): foo = List() model = Model() my_list = model.foo ``` `my_list` is now an object of type `TraitListObject`, and is involved in the...
This came up a few times in the past (e.g. #886): Currently default value is not validated upon trait initialization, so one could do this ``` from traits.api import Int,...
(Reported in another communication channel by @rahulporuri) > it looks like there are a few objects/type declarations missing from the traits.api module Notably, `HasStrictTraits`, `Interface` and `provides` are missing, but...
The current policy in `TraitList`, `TraitSet` and friends is that values that are going to be added to the list/set/whatever are passed through the item validator, while values being removed...