traits
traits copied to clipboard
Observable typed attributes for Python classes
When generating traits defaults, the key method that is used is the `default_value_for` method in ctraits.c which is given the trait, object and trait name, gets the default value and...
For example, see how the default value for `e_` is a string, but is a code object for a non-default value. ``` In [1]: from traits.api import Expression, HasTraits In...
Traits allows specifying a default value for a trait defined in a superclass. But this doesn't work in the expected way for `List`, `Dict` and `Set` traits. For example: ```python...
Difficulties with Traits initialization order are a recurring problem, that I think have cost many of us time in the past. I'm opening this issue to serve as a place...
Motivated by #1619 `BaseTuple` and `Tuple` are somewhat inconsistent about when they accept lists, and it's a bit surprising that they ever accept lists: - `BaseTuple` always accepts lists -...
Mocking methods on HasTraits classes is currently painful; there's a workaround explained in the documentation, but it would be nice to have a way to do this more directly. Suggestion:...
Keeping two trait values synchronized between objects is a fairly common use-case. The `sync_trait` functionality is a way to do this dynamically. Internally it currently uses `on_trait_change`. Either we should...
When iterating through existing adaptation offers for the first time, Traits resolves string-based protocols by performing the appropriate import. That import can execute arbitrary Python code, including code that itself...
Don't know if this a bug, but at least i stumbled upon it: According to documentation using "traits_init", overriding "__init__" or using dynamic initialization with "_name_default" should all lead to...
Consumers of `ListChangeEvent` need to handle both the case of an `int` event index and a `slice` event index, typically leading to code that's branchy, awkward, and hard to test...