We're currently changing our code to use traits and one of the primary
motivators is the power and flexibility that custom metadata allows
us. However, I just discovered that changes to the metadata in one
instance of a traited attribute, changes the value of that metadata
across all instances. The code below shows an example of this. Am I
accessing the metadata incorrectly? Is there a way around this or is
this the expected behavior?
import enthought.traits.api as traits
class Foo(traits.HasTraits):
x = traits.Float(mandatory = True)
first = Foo()
second = Foo()
first_xt = first.trait('x')
second_xt = second.trait('x')
# XXX: I would have expected these asserts to fail
assert first_xt is second_xt
first_xt.mandatory = False
assert second_xt.mandatory == False
Thanks!
Chris
--
Christopher Burns
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
510-643-4053
http://cirl.berkeley.edu/_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev