enthought / traits

Observable typed attributes for Python classes
Other
432 stars 85 forks source link

Reading from an `Event` trait inside a `Tuple` trait should be an error #1541

Open mdickinson opened 2 years ago

mdickinson commented 2 years ago

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:

>>> from traits.api import HasTraits, Event, Tuple
>>> 
>>> class A(HasTraits):
...     foo = Tuple(Event(), Event())
... 
>>> a = A()
>>> a.foo
(<undefined>, <undefined>)
mdickinson commented 2 years ago

Labelling as a bug, though it doesn't seem like a problem that's likely to turn up in real code. Not a high priority to fix for upcoming releases.

mdickinson commented 2 years ago

Whoops; I accidentally autoclosed this by merging #1546 (which said "This PR doesn't fix #1541"). Re-opening.