traits icon indicating copy to clipboard operation
traits copied to clipboard

remove_trait()'s behavior on non-dynamically added traits is undocumented and poorly defined

Open nicolasap-dm opened this issue 5 years ago • 0 comments

remove_trait() is supposed to be used for traits that were added via add_trait(), however this is neither specified in the docstring

https://github.com/enthought/traits/blob/eb0027f3d6a57968104949e5a5fc5d7db9d4a577/traits/has_traits.py#L2842-L2854

or elsewhere in the documentation, nor enforced in the code.

As a result, remove_trait() can be performed with a "static" trait, in which case it erases the trait's value, keeps the trait, and returns False. This behavior should probably be reconsidered or documented.

nicolasap-dm avatar Jan 22 '21 16:01 nicolasap-dm